[issue20691] inspect.signature: Consider exposing 'follow_wrapper_chains' option in public API

Yury Selivanov report at bugs.python.org
Tue May 19 23:20:15 CEST 2015


Yury Selivanov added the comment:

Nick,

> However, as noted, I doubt the latter is worth it - let's just expose the flag to decide whether to resolve wrapper chains or not, and leave the inclusion of the already bound value in the reported signature solely as a legacy behaviour of getargspec and getfullargspec.

I agree.  Please take a look at the attached patch.

BTW, Signature.from_function and Signature.from_builtin aren't documented.  Do you think it's OK if I drop them?  There is no good use case for them (and we have Signature.from_callable in 3.5).

Also, while working on the patch, I noticed that functools.wraps copies __annotations__ attribute.  This is really strange.  Most of the times, wrapper in python has signature akin to (*args, **kwargs).  Blindly copying __annotations__ doesn't make any sense.  What do you think about this?

----------
keywords: +patch
Added file: http://bugs.python.org/file39435/sig_wrapped.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20691>
_______________________________________


More information about the Python-bugs-list mailing list