Feature or enhancement
Proposal:
I propose to provide modern alternatives to and deprecate these inspect members:
Notice: formatargvalues should also be deprecated, because the only way to use is together with getargvalues.
There was a reverted attempt to depracate them in 3.5
It has a rich history of deprecation / undeprecation:
More history: #76371 (comment)
It is broken in a sense that it does not differentiate pos-only from pos-or-keyword parameters.
Can it be replaced with modern tooling? Partially: inspect.signature has some differences. But, getfullargspec() uses signature() internally
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/consider-deprecating-a-bunch-of-inspect-functions/31369
CC @gpshead
Linked PRs
Reactions are currently unavailable
Feature or enhancement
Proposal:
I propose to provide modern alternatives to and deprecate these inspect members:
getargs() undocumented helper used in getargvalues. It works with __code__ objects. Can it be replaced with modern tooling? Not yet: we have an internal helper to get signatures from __code__ objects: https://github.com/python/cpython/blob/39ef93edb9802dccdb6555d4209ac2e60875a011/Lib/inspect.py#L2423-L2488 But, some refactoring is required
getargvalues() only works with frame objects, but it does not work correctly with pos-only and kw-only parameters. Bug: inspect.getargvalues does not work correctly for pos-only and kw-only arguments · Issue #107833 · python/cpython · GitHub Can it be replaced with modern tooling? No, I propose adding inspect.Signature.from_frame method
Notice: formatargvalues should also be deprecated, because the only way to use is together with getargvalues.
There was a reverted attempt to depracate them in 3.5
getcallargs() was documented as deprecated for a long time, it also has known bugs with pos-only params (inspect.getcallargs does not raise TypeError for pos-only passed as keywords · Issue #107831 · python/cpython · GitHub). Can it be replaced with modern tooling? Yes: inspect.Signature.bind
getfullargspec() is documented as
It has a rich history of deprecation / undeprecation:
More history: #76371 (comment)
It is broken in a sense that it does not differentiate pos-only from pos-or-keyword parameters.
Can it be replaced with modern tooling? Partially: inspect.signature has some differences. But, getfullargspec() uses signature() internally
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/consider-deprecating-a-bunch-of-inspect-functions/31369
CC @gpshead
Linked PRs