diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2014-02-21 23:30:53 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2014-02-21 23:30:53 (GMT) |
commit | a773de040d6273588911e6f67e78f45819850b4d (patch) | |
tree | 10b6d5bc93919b8ba8bf9bdd27a298cea09c33d8 /Lib/inspect.py | |
parent | 8c8b4e0ebf5f58fae2d10453cda9d4ee614794d9 (diff) | |
download | cpython-a773de040d6273588911e6f67e78f45819850b4d.zip cpython-a773de040d6273588911e6f67e78f45819850b4d.tar.gz cpython-a773de040d6273588911e6f67e78f45819850b4d.tar.bz2 |
inspect.signature: Check for function-like objects before builtins. Issue #17159
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index b85fbcc..c7a2cf8 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1911,15 +1911,15 @@ def _signature_internal(obj, follow_wrapper_chains=True, skip_bound_arg=True): return sig.replace(parameters=new_params) - if _signature_is_builtin(obj): - return _signature_from_builtin(Signature, obj, - skip_bound_arg=skip_bound_arg) - if isfunction(obj) or _signature_is_functionlike(obj): # If it's a pure Python function, or an object that is duck type # of a Python function (Cython functions, for instance), then: return Signature.from_function(obj) + if _signature_is_builtin(obj): + return _signature_from_builtin(Signature, obj, + skip_bound_arg=skip_bound_arg) + if isinstance(obj, functools.partial): wrapped_sig = _signature_internal(obj.func, follow_wrapper_chains, |