You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deprecate legacy introspection APIs in the inspect module #76371
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2017-12-01.05:22:05.533>labels= ['type-feature', '3.7', 'docs']
title='Separate out legacy introspection APIs in the inspect docs'updated_at=<Date2017-12-01.05:22:05.533>user='https://github.com/ncoghlan'
The deprecation notice on inspect.getfullargspec has been removed, since we want folks porting from Python 2 to rely on it as part of the porting process, rather than feeling they need to upgrade to using inspect.signature() immediately.
At the same time, we really don't want folks relying on it for *new* code, since it has some inherent limitations (like failing to distinguish positional-only args from positional-and-keyword ones), and some odd historical quirks (like reporting the bound arg as part of the signature for already bound methods).
We could potentially add a similar final section to the inspect documentation for "Legacy introspection APIs".
That would also be useful if https://bugs.python.org/issue31230 is eventually implemented - the current generator and coroutine specific APIs could be moved down to the legacy section for backwards compatibility maintenance, with the type independent API being preferred for new code.
changed the title [-]Separate out legacy introspection APIs in the inspect docs[/-][+]Deprecate legacy introspection APIs in the inspect module[/+]on Oct 5, 2022
IMO it's fine to deprecate inspect.getfullargspec(), but don't plan its removal yet. Maybe even add a comment (to avoid people who like removing deprecated functions, like me!) that this deprecated function should be kept for now, since it's still widely used (just add a link to this issue).
The main advantage of inspect.signature(), compared to getfullargspec(), is that it handles positional-only arguments.
inspect.signature() exists since Python 3.3. More and more projects are requiring a minimum Python version of Python 3.7, or Python 3.6 in the worst case. So it's fine to use inspect.signature().
Activity
ncoghlan commentedon Dec 1, 2017
(Follow up to https://bugs.python.org/issue27172)
The deprecation notice on inspect.getfullargspec has been removed, since we want folks porting from Python 2 to rely on it as part of the porting process, rather than feeling they need to upgrade to using inspect.signature() immediately.
At the same time, we really don't want folks relying on it for *new* code, since it has some inherent limitations (like failing to distinguish positional-only args from positional-and-keyword ones), and some odd historical quirks (like reporting the bound arg as part of the signature for already bound methods).
The subprocess modules clearly separates out the "Older high-level API" https://docs.python.org/3/library/subprocess.html#older-high-level-api to help make it clear that new code should use "subprocess.run" instead.
We could potentially add a similar final section to the inspect documentation for "Legacy introspection APIs".
That would also be useful if https://bugs.python.org/issue31230 is eventually implemented - the current generator and coroutine specific APIs could be moved down to the legacy section for backwards compatibility maintenance, with the type independent API being preferred for new code.
[-]Separate out legacy introspection APIs in the inspect docs[/-][+]Deprecate legacy introspection APIs in the inspect module[/+]iritkatriel commentedon Oct 5, 2022
Repurposing this issue to re-deprecate these APIs instead.
vstinner commentedon Oct 6, 2022
My notes on "Python 3.11: remove inspect.getargspec()":
Part 1:
Part 2:
Part 3:
Broken project (1):
sqlalchemy:
vstinner commentedon Oct 6, 2022
IMO it's fine to deprecate inspect.getfullargspec(), but don't plan its removal yet. Maybe even add a comment (to avoid people who like removing deprecated functions, like me!) that this deprecated function should be kept for now, since it's still widely used (just add a link to this issue).
The main advantage of inspect.signature(), compared to getfullargspec(), is that it handles positional-only arguments.
inspect.signature() exists since Python 3.3. More and more projects are requiring a minimum Python version of Python 3.7, or Python 3.6 in the worst case. So it's fine to use inspect.signature().