Terry J. Reedy added the comment:
We usually prefer diffs rather than revised files, but I know not everyone can
provide them. Did you change anything other than add the following?
elif hasattr(ob, '__wrapped__') and callable(ob.__wrapped__):
fob = ob.__wrapped__
I am all for accurate calltips. However, your patch will not work for the
stdlib wrapper functools.partial. It does not add a __wrapped__ attribute.
Instead it had args, func, and kwargs attributes.
I plan on switching calltips from using inspect.getfullargspec to
inspect.signature (#19903). The latter defaults to follow_wrapped=True, in
which case, it should follow callable.__wrapped__.
https://docs.python.org/3/library/inspect.html#inspect.signature. It also is
documented to work with partials and in my test, it indeed followed .func to
get the original signature and remove the parameters set in the partial call.
So this request is a duplicate in that it will be fixed by the existing issue.
----------
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Idle: Use inspect.signature for calltips
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29653>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com