This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: IDLE - call tips show wrapper's argpsec instead of wrapped
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.6
Status: closed Resolution: duplicate
Dependencies: Superseder: Idle: Use inspect.signature for calltips
View: 19903
Assigned To: terry.reedy Nosy List: bup, terry.reedy
Priority: normal Keywords:

Created on 2017-02-25 20:34 by bup, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit bup, 2017-02-25 20:34
Messages (2)
msg288580 - (view) Author: Dan Snider (bup) * Date: 2017-02-25 20:34
Many wrappers use the famous (*args, **kwargs) argspec, which is less than helpful for a function that uses some positional arguments and maybe a few keyword only arguments, ie (x, y, z=10). Other IDEs have the capability of showing the wrapped functions argspec in a calltip, so why shouldn't IDLE?
msg288584 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-02-25 22:50
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__.  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.
Date User Action Args
2022-04-11 14:58:43adminsetgithub: 73839
2017-02-25 22:50:10terry.reedysetstatus: open -> closed
superseder: Idle: Use inspect.signature for calltips
messages: + msg288584

resolution: duplicate
stage: resolved
2017-02-25 20:34:32bupcreate