summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-02-21 23:30:53 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-02-21 23:30:53 (GMT)
commit8dfb4576a9a74a35f71a2f68a7236f2f0b1a7e63 (patch)
treefba3299799c958d3ff6247ce9c90d29c18d60673 /Lib/inspect.py
parente2df3ea682e4b51ed6357ed9e105b2618616e839 (diff)
downloadcpython-8dfb4576a9a74a35f71a2f68a7236f2f0b1a7e63.zip
cpython-8dfb4576a9a74a35f71a2f68a7236f2f0b1a7e63.tar.gz
cpython-8dfb4576a9a74a35f71a2f68a7236f2f0b1a7e63.tar.bz2
inspect.signature: Check for function-like objects before builtins. Issue #17159
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py8
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,