René's URL Explorer Experiment


Title: Add modern alternatives to `inspect` module, deprecate old incorrect APIs · Issue #108901 · python/cpython · GitHub

Open Graph Title: Add modern alternatives to `inspect` module, deprecate old incorrect APIs · Issue #108901 · python/cpython

X Title: Add modern alternatives to `inspect` module, deprecate old incorrect APIs · Issue #108901 · python/cpython

Description: 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?...

Open Graph Description: 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....

X Description: 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....

Opengraph URL: https://github.com/python/cpython/issues/108901

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add modern alternatives to `inspect` module, deprecate old incorrect APIs","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nI propose to provide modern alternatives to and deprecate these `inspect` members:\n\n- `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 ](https://github.com/python/cpython/blob/39ef93edb9802dccdb6555d4209ac2e60875a011/Lib/inspect.py#L2423-L2488)But, some refactoring is required\n\n- `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](https://github.com/python/cpython/issues/107833) Can it be replaced with modern tooling? No, I propose adding `inspect.Signature.from_frame` method\n\nNotice: formatargvalues should also be deprecated, because the only way to use is together with getargvalues.\n\nThere was a reverted attempt to depracate them in 3.5\n\n- `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](https://github.com/python/cpython/issues/107831)). Can it be replaced with modern tooling? Yes: `inspect.Signature.bind`\n\n- `getfullargspec()` is documented as\n\n    > Note that [signature()](https://docs.python.org/3/library/inspect.html#inspect.signature) and [Signature Object](https://docs.python.org/3/library/inspect.html#inspect-signature-object) provide the recommended API for callable introspection, and support additional behaviours (like positional-only arguments) that are sometimes encountered in extension module APIs. This function is retained primarily for use in code that needs to maintain compatibility with the Python 2 inspect module API.\n\nIt has a rich history of deprecation / undeprecation:\n\n- Deprecated: https://github.com/python/cpython/issues/64637\n- Undeprecated: https://github.com/python/cpython/issues/71359\n- Suggested to be deprecated again: https://github.com/python/cpython/issues/76371\n\nMore history: https://github.com/python/cpython/issues/76371#issuecomment-1270007408\n\nIt is broken in a sense that it does not differentiate pos-only from pos-or-keyword parameters.\n\nCan it be replaced with modern tooling? Partially: `inspect.signature` has some differences. But, `getfullargspec()` uses `signature()` internally\n\n### Has this already been discussed elsewhere?\n\nI have already discussed this feature proposal on Discourse\n\n### Links to previous discussion of this feature:\n\nhttps://discuss.python.org/t/consider-deprecating-a-bunch-of-inspect-functions/31369\n\nCC @gpshead \n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-108902\n* gh-112236\n* gh-112279\n* gh-112314\n* gh-112639\n* gh-116537\n* gh-116559\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2023-09-05T10:20:18Z","url":"https://github.com/python/cpython/issues/108901"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:937c564c-1fdd-d7d4-8cec-6e7d7bccd123
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id84A4:38E318:347A66B:426CA72:6B0211D5
html-safe-nonce3bb462bf5405c3e1cf0af4a50a40502d5e6694a02014589700bf809a55413c94
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEE0OjM4RTMxODozNDdBNjZCOjQyNkNBNzI6NkIwMjExRDUiLCJ2aXNpdG9yX2lkIjoiOTIxNDg5MzY0ODY1MzcxNzk3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace95d911915c7f47d8875794cda1e915f23b7c85cb22ad58f792d40fa40e7a659
hovercard-subject-tagissue:1881667694
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/108901/issue_layout
twitter:imagehttps://opengraph.githubassets.com/70f8e38e05e2d68d4c99d9a14977dc469aab5362a7ca374a5199769c02df3e1e/python/cpython/issues/108901
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/70f8e38e05e2d68d4c99d9a14977dc469aab5362a7ca374a5199769c02df3e1e/python/cpython/issues/108901
og:image:altFeature 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....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesobolevn
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/108901#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F108901
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F108901
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/108901
Reloadhttps://github.com/python/cpython/issues/108901
Reloadhttps://github.com/python/cpython/issues/108901
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/108901
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/108901
Add modern alternatives to inspect module, deprecate old incorrect APIshttps://github.com/python/cpython/issues/108901#top
https://github.com/sobolevn
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/sobolevn
sobolevnhttps://github.com/sobolevn
on Sep 5, 2023https://github.com/python/cpython/issues/108901#issue-1881667694
https://github.com/python/cpython/blob/39ef93edb9802dccdb6555d4209ac2e60875a011/Lib/inspect.py#L2423-L2488 https://github.com/python/cpython/blob/39ef93edb9802dccdb6555d4209ac2e60875a011/Lib/inspect.py#L2423-L2488
inspect.getargvalues does not work correctly for pos-only and kw-only arguments · Issue #107833 · python/cpython · GitHubhttps://github.com/python/cpython/issues/107833
inspect.getcallargs does not raise TypeError for pos-only passed as keywords · Issue #107831 · python/cpython · GitHubhttps://github.com/python/cpython/issues/107831
signature()https://docs.python.org/3/library/inspect.html#inspect.signature
Signature Objecthttps://docs.python.org/3/library/inspect.html#inspect-signature-object
inspect: Deprecate getfullargspec? #64637https://github.com/python/cpython/issues/64637
Undeprecate inspect.getfullargspec() #71359https://github.com/python/cpython/issues/71359
Deprecate legacy introspection APIs in the inspect module #76371https://github.com/python/cpython/issues/76371
#76371 (comment)https://github.com/python/cpython/issues/76371#issuecomment-1270007408
https://discuss.python.org/t/consider-deprecating-a-bunch-of-inspect-functions/31369https://discuss.python.org/t/consider-deprecating-a-bunch-of-inspect-functions/31369
@gpsheadhttps://github.com/gpshead
gh-108901: Add Signature.from_code method #108902https://github.com/python/cpython/pull/108902
gh-108901: Deprecate inspect.getcallargs and slate it for removal #112236https://github.com/python/cpython/pull/112236
gh-108901: Deprecate inspect.getargs, slate it for removal in 3.15 #112279https://github.com/python/cpython/pull/112279
gh-108901: Deprecate inspect.getfullargspec and slate it for removal in 3.15 #112314https://github.com/python/cpython/pull/112314
gh-108901: Deprecate inspect.getargvalues and inspect.formatargvalues, provide modern alternative #112639https://github.com/python/cpython/pull/112639
gh-108901: Add inspect.Signature.from_frame #116537https://github.com/python/cpython/pull/116537
gh-108901: Add bound_arg to Signature.from_callable() and signature() #116559https://github.com/python/cpython/pull/116559
sobolevnhttps://github.com/sobolevn
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
on Sep 5, 2023https://github.com/python/cpython/issues/108901#event-10281772388
sobolevnhttps://github.com/sobolevn
on Sep 5, 2023https://github.com/python/cpython/issues/108901#event-10281772503
https://github.com/sobolevn
sobolevnhttps://github.com/sobolevn
on Sep 5, 2023https://github.com/python/cpython/issues/108901#issuecomment-1706348202
sobolevnhttps://github.com/sobolevn
on Sep 5, 2023https://github.com/python/cpython/issues/108901#event-10281809623
pythongh-108901: Deprecate `inspect.getargs`, use `Signature.from_cod…https://github.com/sobolevn/cpython/commit/566790c56673e577d1242863216a7f952eaf3b7d
pythongh-108901https://github.com/python/cpython/issues/108901
566790chttps://github.com/sobolevn/cpython/commit/566790c56673e577d1242863216a7f952eaf3b7d
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Sep 5, 2023https://github.com/python/cpython/issues/108901#issuecomment-1706905470
https://github.com/sobolevn
sobolevnhttps://github.com/sobolevn
on Sep 5, 2023https://github.com/python/cpython/issues/108901#issuecomment-1706919273
sobolevnhttps://github.com/sobolevn
on Nov 18, 2023https://github.com/python/cpython/issues/108901#event-11001816796
pythongh-108901: Deprecate `inspect.getcallargs` and slate it for rem…https://github.com/sobolevn/cpython/commit/cdcfe55da4cd9686bd0b3976a0b1710f31ec2be2
pythongh-108901https://github.com/python/cpython/issues/108901
cdcfe55https://github.com/sobolevn/cpython/commit/cdcfe55da4cd9686bd0b3976a0b1710f31ec2be2
pythongh-108901: Deprecate `inspect.getargs`, slate it for removal in…https://github.com/sobolevn/cpython/commit/18ae53938ec24ea2b734094e2bc2ff683cf6bf78
pythongh-108901https://github.com/python/cpython/issues/108901
18ae539https://github.com/sobolevn/cpython/commit/18ae53938ec24ea2b734094e2bc2ff683cf6bf78
pythongh-108901: Deprecate `inspect.getfullargspec` and slate it for …https://github.com/sobolevn/cpython/commit/41c4e36eca4bdbfc4261e2c9962bd7c678825e9b
pythongh-108901https://github.com/python/cpython/issues/108901
41c4e36https://github.com/sobolevn/cpython/commit/41c4e36eca4bdbfc4261e2c9962bd7c678825e9b
https://github.com/hugovk
hugovkhttps://github.com/hugovk
on Nov 22, 2023https://github.com/python/cpython/issues/108901#issuecomment-1822775012
#112236https://github.com/python/cpython/pull/112236
#112279https://github.com/python/cpython/pull/112279
#112314https://github.com/python/cpython/pull/112314
Porting to Python 3.13https://docs.python.org/3.13/whatsnew/3.13.html#porting-to-python-3-13
https://github.com/sobolevn
sobolevnhttps://github.com/sobolevn
on Nov 22, 2023https://github.com/python/cpython/issues/108901#issuecomment-1822782203
https://github.com/hugovk
hugovkhttps://github.com/hugovk
on Nov 22, 2023https://github.com/python/cpython/issues/108901#issuecomment-1822789163
inspect.getfullargspec.txthttps://github.com/python/cpython/files/13440131/inspect.getfullargspec.txt
iritkatrielhttps://github.com/iritkatriel
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Nov 28, 2023https://github.com/python/cpython/issues/108901#event-11083076950
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Jan 10, 2024https://github.com/python/cpython/issues/108901#issuecomment-1885902222
serhiy-storchakahttps://github.com/serhiy-storchaka
Inspect issues 🔍https://github.com/orgs/python/projects/45
on Mar 5, 2024https://github.com/python/cpython/issues/108901#event-14885161880
sobolevnhttps://github.com/sobolevn
on Mar 9, 2024https://github.com/python/cpython/issues/108901#event-12062832407
pythongh-108901: Add `inspect.Signature.from_frame`https://github.com/sobolevn/cpython/commit/e0df986fa160819b9d0906a5371ac4cfc3258d0b
pythongh-108901https://github.com/python/cpython/issues/108901
e0df986https://github.com/sobolevn/cpython/commit/e0df986fa160819b9d0906a5371ac4cfc3258d0b
pythongh-108901: Add `skip_bound_arg` to `Signature.from_callable()` …https://github.com/sobolevn/cpython/commit/290e1ad38ec290fac5866169584c25f41f4a273c
pythongh-108901https://github.com/python/cpython/issues/108901
290e1adhttps://github.com/sobolevn/cpython/commit/290e1ad38ec290fac5866169584c25f41f4a273c
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/108901
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/108901
sobolevnhttps://github.com/sobolevn
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
Inspect issues 🔍https://github.com/orgs/python/projects/45
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.