Issue 29653: IDLE - call tips show wrapper's argpsec instead of wrapped (original) (raw)
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?
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.