[issue27172] Undeprecate inspect.getfullargspec()

Nick Coghlan report at bugs.python.org
Sun Nov 27 08:13:20 EST 2016


Nick Coghlan added the comment:

Initial patch attached. Key missing pieces:

- needs a What's New note
- needs to undeprecate inspect.getcallargs() as well (more on that below)

As my last couple of comments indicate, I'd forgotten that only getargspec() was programmatically deprecated, which means the sole code change is a rewording of the getargspec() warning to mention both signature() and getfullargspec().

The documentation changes are a bit more extensive, as I couldn't resist fixing the longstanding terminology error in the docs and docstrings, where these functions are mostly reporting *parameter* names, not argument names (callable arguments have values, not names).

I think the "versionchanged" note works well for indicating that folks aren't imagining things if they remembered seeing this function marked as deprecated.

However, I also went back and checked the 3.5 What's New, and that does mention the deprecations, so I'll need to do another version of this patch that includes a 3.6 What's New notice retracting those deprecations.

That check also reveals some other documented deprecations that should probably be reverted.

Firstly, getargvalues() and formatargvalues() are *frame* introspection functions, and hence have nothing whatsoever to do with inspect.signature(). The code and docs are just a bit confusing as they're interleaved with the callable introspection functions. I've filed that as a new issue: http://bugs.python.org/issue28814

Secondly, https://bugs.python.org/issue20438#msg254892 notes that inspect.getcallargs() has some behaviours that differ from Signature.bind in a way that's a bit of a pain to replicate on top of the latter. Similar to getfullargspec(), what do folks think of the idea of reverting that deprecation at least until 2.7 goes EOL?

(Noting for the record so folks don't wonder if it's an accidental oversight: I think formatargspec should retain its documented deprecation, as folks really are better off writing their own formatting function based on the data returned or switching to the new signature API)

----------
keywords: +patch
Added file: http://bugs.python.org/file45663/issue27172_undeprecate_getfullargspec.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27172>
_______________________________________


More information about the Python-bugs-list mailing list