René's URL Explorer Experiment


Title: gh-92041: Resolve registered frames from verified globals ownership by mdeck · Pull Request #160254 · python/cpython · GitHub

Open Graph Title: gh-92041: Resolve registered frames from verified globals ownership by mdeck · Pull Request #160254 · python/cpython

X Title: gh-92041: Resolve registered frames from verified globals ownership by mdeck · Pull Request #160254 · python/cpython

Description: Resolve registered frames and tracebacks directly from their globals owner when the registered module identity and normalized filename match. This avoids scanning sys.modules and gives a verified owner consistent precedence over a conflicting filename-cache entry. Successful ownership resolution does not populate the shared filename map, so bare code-object lookup remains filename based and is not changed by this fast path. A cached exact module with the frame's identical globals can be returned immediately: it cannot conceal a different globals owner, and the existing filename fallback would return that same module. Other cached results still require ownership verification. Private execution namespaces, mismatched origins, module subclasses, dynamic filenames, fileless modules and unrelated filename overrides retain the filename fallback. Source/bytecode normalization is preserved. Source retrieval is unchanged, including linecache.getlines() overrides and the module globals passed to them. Documentation and NEWS describe the ownership precedence directly. This implements the frame/traceback split discussed in #92042. It remains independent of and complementary to #156685; the changes compose cleanly in either order. No registry watchers, C changes or negative caching are included. Performance Measurements use source-pinned variants in one CPython 3.16 -O3 Linux build without PGO/LTO. Eight fresh processes use counterbalanced ABBA/BAAB batches; intervals are 95% process-level bootstrap intervals, with all samples retained and identical-code controls. Direct registered-frame lookup with warm filename caches: about 2.04 µs on the pinned mainline versus 0.40 µs with this revision; paired time ratio 0.199 (0.195–0.203), approximately 5× faster. Four-frame source-context stack with warm filename/source caches: paired time ratio 1.002 (0.992–1.012) versus mainline. No statistically resolved regression; smaller effects remain unresolved. The same stack with #156685 composed: ratio 1.006 (0.996–1.016) versus that replacement alone. Explicit cached frame lookup: about 0.271 → 0.266 µs. Ordinary-function lookup costs about 11 ns more; warm code-object lookup about 15 ns more. Ownership verification has costs on fallback paths: explicit cached private-namespace lookup about 0.275 → 0.508 µs, and a registered frame executing a different source file about 0.280 → 1.512 µs. These paths are not claimed as performance improvements. These are microbenchmark results for the specified workloads, not an application-wide speedup. Earlier cold-registry measurements linked in the discussion concern earlier source snapshots and are not presented as measurements of this revision. Validation Six suites pass standalone and composed with #156685: inspect, zipimport support, import, linecache, traceback and pydoc. Each run reports 1,149 tests, 4 skipped, with --fail-env-changed. 648 cold differential cases preserve mainline behavior outside the intended collision change. 5,184 cached cases preserve the preceding ownership revision's results. Regression coverage includes conflicting cached modules, module subclasses spoofing globals, source/bytecode aliases, explicit filename overrides, registry replacement and linecache.getlines() hooks receiving the frame owner's globals. Configured lint hooks and git diff --check pass. Native build, normal documentation HTML and changelog builds pass. The project's documentation warning gate passes; existing baseline nitpicky warnings remain. Developed and tested with Codex (AI assistance). Issue: gh-92041

Open Graph Description: Resolve registered frames and tracebacks directly from their globals owner when the registered module identity and normalized filename match. This avoids scanning sys.modules and gives a verified o...

X Description: Resolve registered frames and tracebacks directly from their globals owner when the registered module identity and normalized filename match. This avoids scanning sys.modules and gives a verified o...

Opengraph URL: https://github.com/python/cpython/pull/160254

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4

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/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:8480d8e0-137c-25bf-9519-6b154e3f8dc9
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD276:1CA0E6:D4A5FE:121071F:6B064E24
html-safe-noncefd12c6d10d698f07c512cb66b32f85217f57113ad15ee5dbb02c8e391028706c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjc2OjFDQTBFNjpENEE1RkU6MTIxMDcxRjo2QjA2NEUyNCIsInZpc2l0b3JfaWQiOiI0MTI4OTU2MzU3ODU0Nzc2ODY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac1df767249b3b079a91536e1805b2780285c81a258bb7d4261c6c80ad471d9574
hovercard-subject-tagpull_request:4969579266
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/160254/files
twitter:imagehttps://avatars.githubusercontent.com/u/1872833?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1872833?s=400&v=4
og:image:altResolve registered frames and tracebacks directly from their globals owner when the registered module identity and normalized filename match. This avoids scanning sys.modules and gives a verified o...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef1f9a08f7c769a37f1dfc18ad43d463c222a7eea
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/160254/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F160254%2Ffiles
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%2Fpull%2F160254%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/160254/files
Reloadhttps://github.com/python/cpython/pull/160254/files
Reloadhttps://github.com/python/cpython/pull/160254/files
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
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
mdeckhttps://github.com/mdeck
python:mainhttps://github.com/python/cpython/tree/main
mdeck:inspect-registered-frame-fastpath-20261022https://github.com/mdeck/cpython/tree/inspect-registered-frame-fastpath-20261022
Conversation 11 https://github.com/python/cpython/pull/160254
Commits 5 https://github.com/python/cpython/pull/160254/commits
Checks 49 https://github.com/python/cpython/pull/160254/checks
Files changed https://github.com/python/cpython/pull/160254/files
Please reload this pagehttps://github.com/python/cpython/pull/160254/files
gh-92041: Resolve registered frames from verified globals ownership https://github.com/python/cpython/pull/160254/files#top
Show all changes 5 commits https://github.com/python/cpython/pull/160254/files
530c2f0 gh-92041: Avoid registry scans for uncached registered frames mdeck Oct 22, 2026 https://github.com/python/cpython/pull/160254/commits/530c2f0ca9918a8f43ec3aeb06a698eb01419600
6c72434 Exercise cold frame and traceback resolution independently mdeck Oct 22, 2026 https://github.com/python/cpython/pull/160254/commits/6c72434f0e04c950a3908ebf40b1b5d27f64c72a
bda170b Avoid shadowed module filename in dynamic metadata fixture mdeck Oct 22, 2026 https://github.com/python/cpython/pull/160254/commits/bda170b70b98398fa0d14abc0a190beb8efaee13
ef27738 gh-92041: Address frame lookup review and document cache precedence mdeck Oct 22, 2026 https://github.com/python/cpython/pull/160254/commits/ef27738a6fea5551f4176e370ba5b3c0a63dd5da
6a91668 gh-92041: Verify frame ownership and retain safe cached module hits mdeck Oct 24, 2026 https://github.com/python/cpython/pull/160254/commits/6a916683df63b1a6b8bfe9d3a105d09eaab1c09c
Clear filters https://github.com/python/cpython/pull/160254/files
Please reload this pagehttps://github.com/python/cpython/pull/160254/files
Please reload this pagehttps://github.com/python/cpython/pull/160254/files
inspect.rst https://github.com/python/cpython/pull/160254/files#diff-28534bf091e28ca43bf9d54227179e5bb8297a038072241978f9b4f954427ae3
inspect.py https://github.com/python/cpython/pull/160254/files#diff-b89cd06e4637abacb73f2500301ff979a67ad7ecbfa7cf151c7243715898d7ea
test_inspect.py https://github.com/python/cpython/pull/160254/files#diff-92d8ecc68ed9e7ce3b31a764d5b0368db1514365c2a6433bbe3bad5c3210cea0
2026-10-22-00-00-00.gh-issue-92041.frame.rst https://github.com/python/cpython/pull/160254/files#diff-bd3389aca4d5b1ffaaf49baaf4d556ec491f231e4d833f197e76e9313a038a17
Doc/library/inspect.rsthttps://github.com/python/cpython/pull/160254/files#diff-28534bf091e28ca43bf9d54227179e5bb8297a038072241978f9b4f954427ae3
View file https://github.com/python/cpython/blob/6a916683df63b1a6b8bfe9d3a105d09eaab1c09c/Doc/library/inspect.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/160254/{{ revealButtonHref }}
https://github.com/python/cpython/pull/160254/files#diff-28534bf091e28ca43bf9d54227179e5bb8297a038072241978f9b4f954427ae3
https://github.com/python/cpython/pull/160254/files#diff-28534bf091e28ca43bf9d54227179e5bb8297a038072241978f9b4f954427ae3
Lib/inspect.pyhttps://github.com/python/cpython/pull/160254/files#diff-b89cd06e4637abacb73f2500301ff979a67ad7ecbfa7cf151c7243715898d7ea
View file https://github.com/python/cpython/blob/6a916683df63b1a6b8bfe9d3a105d09eaab1c09c/Lib/inspect.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/160254/{{ revealButtonHref }}
https://github.com/python/cpython/pull/160254/files#diff-b89cd06e4637abacb73f2500301ff979a67ad7ecbfa7cf151c7243715898d7ea
https://github.com/python/cpython/pull/160254/files#diff-b89cd06e4637abacb73f2500301ff979a67ad7ecbfa7cf151c7243715898d7ea
Please reload this pagehttps://github.com/python/cpython/pull/160254/files
Please reload this pagehttps://github.com/python/cpython/pull/160254/files
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.