diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-20 18:30:08 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-20 18:30:08 (GMT) |
commit | bcd4fc161ae40aaed4c8812d0bf37aa94c6cc2df (patch) | |
tree | 0d676ad431eba126313a76b126f6bc45d83b30f1 /Lib/inspect.py | |
parent | 1f507a81405dd7234dd97465d68fcc8437b5da0e (diff) | |
download | cpython-bcd4fc161ae40aaed4c8812d0bf37aa94c6cc2df.zip cpython-bcd4fc161ae40aaed4c8812d0bf37aa94c6cc2df.tar.gz cpython-bcd4fc161ae40aaed4c8812d0bf37aa94c6cc2df.tar.bz2 |
Issue 20691: Add follow_wrapped arg to inspect.signature/from_callable.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 13d0c7b..9ad55a9 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2664,9 +2664,10 @@ class Signature: return _signature_from_builtin(cls, func) @classmethod - def from_callable(cls, obj): + def from_callable(cls, obj, *, follow_wrapped=True): """Constructs Signature for the given callable object.""" - return _signature_from_callable(obj, sigcls=cls) + return _signature_from_callable(obj, sigcls=cls, + follow_wrapper_chains=follow_wrapped) @property def parameters(self): @@ -2915,9 +2916,9 @@ class Signature: return rendered -def signature(obj): +def signature(obj, *, follow_wrapped=True): """Get a signature object for the passed callable.""" - return Signature.from_callable(obj) + return Signature.from_callable(obj, follow_wrapped=follow_wrapped) def _main(): |