[issue29653] IDLE - call tips show wrapper's argpsec instead of wrapped

Terry J. Reedy report at bugs.python.org
Sat Feb 25 17:50:10 EST 2017


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 <report at bugs.python.org>
<http://bugs.python.org/issue29653>
_______________________________________


More information about the Python-bugs-list mailing list