Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdks/python/apache_beam/transforms/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ def get_function_args_defaults(f):
it doesn't include bound arguments and may follow function wrappers.
"""
signature = get_signature(f)
# Fall back on funcsigs if inspect module doesn't have 'Parameter'; prefer
# inspect.Parameter over funcsigs.Parameter if both are available.
try:
parameter = inspect.Parameter
except AttributeError:
Expand Down
8 changes: 5 additions & 3 deletions sdks/python/apache_beam/typehints/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ def get_signature(func):
latter: 'the "self" parameter is always reported, even for bound methods'
https://github.com/python/cpython/blob/44f91c388a6f4da9ed3300df32ca290b8aa104ea/Lib/inspect.py#L1103
"""
if funcsigs is not None:
inspect_ = funcsigs
else:
# Fall back on funcsigs if inspect module doesn't have 'signature'; prefer
# inspect.signature over funcsigs.signature if both are available.
if hasattr(inspect, 'signature'):
inspect_ = inspect
else:
inspect_ = funcsigs

try:
signature = inspect_.signature(func)
Expand Down