mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
Issue 20691: Add follow_wrapped arg to inspect.signature/from_callable.
This commit is contained in:
parent
1f507a8140
commit
bcd4fc161a
5 changed files with 36 additions and 10 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue