[pypy-commit] pypy py3.5: Allow inspect._signature_from_callable() to work on builtins (by handling them like user functions)

rlamy pypy.commits at gmail.com
Tue Nov 14 11:31:52 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r93014:5d5dfbb116aa
Date: 2017-11-14 16:31 +0000
http://bitbucket.org/pypy/pypy/changeset/5d5dfbb116aa/

Log:	Allow inspect._signature_from_callable() to work on builtins (by
	handling them like user functions)

diff --git a/lib-python/3/inspect.py b/lib-python/3/inspect.py
--- a/lib-python/3/inspect.py
+++ b/lib-python/3/inspect.py
@@ -1828,7 +1828,7 @@
     kwdefaults = getattr(obj, '__kwdefaults__', _void) # ... and not None here
     annotations = getattr(obj, '__annotations__', None)
 
-    return (isinstance(code, types.CodeType) and
+    return (isinstance(code, (types.CodeType, _builtin_code_type)) and
             isinstance(name, str) and
             (defaults is None or isinstance(defaults, tuple)) and
             (kwdefaults is None or isinstance(kwdefaults, dict)) and


More information about the pypy-commit mailing list