René's URL Explorer Experiment


Title: BINARY_OP_SUBSCR_LIST_INT / STORE_SUBSCR_LIST_INT silently depend on _GUARD_TOS_INT enforcing compactness · Issue #150587 · python/cpython · GitHub

Open Graph Title: BINARY_OP_SUBSCR_LIST_INT / STORE_SUBSCR_LIST_INT silently depend on _GUARD_TOS_INT enforcing compactness · Issue #150587 · python/cpython

X Title: BINARY_OP_SUBSCR_LIST_INT / STORE_SUBSCR_LIST_INT silently depend on _GUARD_TOS_INT enforcing compactness · Issue #150587 · python/cpython

Description: Summary _BINARY_OP_SUBSCR_LIST_INT and _STORE_SUBSCR_LIST_INT call _PyLong_CompactValue on the subscript without verifying compactness themselves. They rely entirely on _GUARD_TOS_INT to have already rejected any non-compact int. This is...

Open Graph Description: Summary _BINARY_OP_SUBSCR_LIST_INT and _STORE_SUBSCR_LIST_INT call _PyLong_CompactValue on the subscript without verifying compactness themselves. They rely entirely on _GUARD_TOS_INT to have alrea...

X Description: Summary _BINARY_OP_SUBSCR_LIST_INT and _STORE_SUBSCR_LIST_INT call _PyLong_CompactValue on the subscript without verifying compactness themselves. They rely entirely on _GUARD_TOS_INT to have alrea...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BINARY_OP_SUBSCR_LIST_INT / STORE_SUBSCR_LIST_INT silently depend on _GUARD_TOS_INT enforcing compactness","articleBody":"## Summary\n\n`_BINARY_OP_SUBSCR_LIST_INT` and `_STORE_SUBSCR_LIST_INT` call `_PyLong_CompactValue`\non the subscript without verifying compactness themselves. They rely entirely on\n`_GUARD_TOS_INT` to have already rejected any non-compact int. This is an undocumented\ninvariant: if `_GUARD_TOS_INT` is ever relaxed, `_PyLong_CompactValue` will be called\non a wide int, reading `ob_digit[0]` as the index instead of the full value and\nsilently returning the wrong list element.\n\n## Details\n\nThe specializer gates `BINARY_OP_SUBSCR_LIST_INT`\n([specialize.c:2391](https://github.com/python/cpython/blob/main/Python/specialize.c#L2391))\nand `STORE_SUBSCR_LIST_INT`\n([specialize.c:1575](https://github.com/python/cpython/blob/main/Python/specialize.c#L1575))\non `_PyLong_IsNonNegativeCompact` — only compact non-negative subscripts trigger\nspecialization. The runtime guard `_GUARD_TOS_INT`\n([bytecodes.c:640](https://github.com/python/cpython/blob/main/Python/bytecodes.c#L640))\ncurrently checks `_PyLong_CheckExactAndCompact`, so the invariant holds today.\n\nHowever, the opcode bodies\n([`_BINARY_OP_SUBSCR_LIST_INT`](https://github.com/python/cpython/blob/main/Python/bytecodes.c#L1138),\n[`_STORE_SUBSCR_LIST_INT`](https://github.com/python/cpython/blob/main/Python/bytecodes.c#L1416))\ndo not re-verify compactness before calling `_PyLong_CompactValue`\n([longintrepr.h:130](https://github.com/python/cpython/blob/main/Include/cpython/longintrepr.h#L130)).\nIf `_GUARD_TOS_INT` were relaxed to accept wider ints (e.g. to `PyLong_CheckExact`),\na wide int subscript would pass the guard and reach `_PyLong_CompactValue` in an\ninvalid state. For a wide positive int `n = ob_digit[0] + ob_digit[1] * 2^30 + ...`,\n`_PyLong_CompactValue` reads only `ob_digit[0]`, silently producing the wrong index.\nOn a debug build this fires `assert(PyUnstable_Long_IsCompact(op))` inside\n`_PyLong_CompactValue`.\n\n## Fix\n\nAdd `EXIT_IF(!_PyLong_IsNonNegativeCompact((PyLongObject *)sub))` to\n`_BINARY_OP_SUBSCR_LIST_INT` and `DEOPT_IF(!_PyLong_IsNonNegativeCompact((PyLongObject *)sub))`\nto `_STORE_SUBSCR_LIST_INT`, immediately before the `_PyLong_CompactValue` call.\nEach opcode then enforces its own precondition rather than relying on the guard's\ncurrent strength.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-150588\n* gh-153004\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/KRRT7","@type":"Person","name":"KRRT7"},"datePublished":"2026-05-29T19:26:42Z","url":"https://github.com/python/cpython/issues/150587"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:29cec4ba-aeb5-bb7b-bf9c-390e5cd996a3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAFA6:12B5A4:292CEF:38398E:6AECB604
html-safe-nonce941492a10b22dfd8b990274afd44a1999c5b0671c3a4af0784c33c0e1612f4a5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkE2OjEyQjVBNDoyOTJDRUY6MzgzOThFOjZBRUNCNjA0IiwidmlzaXRvcl9pZCI6Ijg4MDc2Mzk3NjQ0MDQzMTk3NDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaccca10589e3c1893de43a429196fcf5da471944ef01239efb84b26af5e77e53ed
hovercard-subject-tagissue:4551063387
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/150587/issue_layout
twitter:imagehttps://opengraph.githubassets.com/239587753ba228759597b95e3e688570feb00ef7d92d25f5f95c9524577c0721/python/cpython/issues/150587
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/239587753ba228759597b95e3e688570feb00ef7d92d25f5f95c9524577c0721/python/cpython/issues/150587
og:image:altSummary _BINARY_OP_SUBSCR_LIST_INT and _STORE_SUBSCR_LIST_INT call _PyLong_CompactValue on the subscript without verifying compactness themselves. They rely entirely on _GUARD_TOS_INT to have alrea...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameKRRT7
hostnamegithub.com
expected-hostnamegithub.com
None95ae5445dec4cded2bc4f9d97ede92b9116c0bf381a08a5c844b60b5bddcbc97
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
releasedb4ef601a7f034ae2a68e17d6eeaeb7ee9470192
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/150587#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F150587
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%2F150587
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/150587
Reloadhttps://github.com/python/cpython/issues/150587
Reloadhttps://github.com/python/cpython/issues/150587
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.3k (2.3k)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/pulse
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/150587
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/150587
BINARY_OP_SUBSCR_LIST_INT / STORE_SUBSCR_LIST_INT silently depend on _GUARD_TOS_INT enforcing compactnesshttps://github.com/python/cpython/issues/150587#top
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/KRRT7
KRRT7https://github.com/KRRT7
on May 29, 2026https://github.com/python/cpython/issues/150587#issue-4551063387
specialize.c:2391https://github.com/python/cpython/blob/main/Python/specialize.c#L2391
specialize.c:1575https://github.com/python/cpython/blob/main/Python/specialize.c#L1575
bytecodes.c:640https://github.com/python/cpython/blob/main/Python/bytecodes.c#L640
_BINARY_OP_SUBSCR_LIST_INThttps://github.com/python/cpython/blob/main/Python/bytecodes.c#L1138
_STORE_SUBSCR_LIST_INThttps://github.com/python/cpython/blob/main/Python/bytecodes.c#L1416
longintrepr.h:130https://github.com/python/cpython/blob/main/Include/cpython/longintrepr.h#L130
gh-150587: Harden BINARY_OP_SUBSCR_LIST_INT/STORE_SUBSCR_LIST_INT against non-compact int subscripts #150588https://github.com/python/cpython/pull/150588
gh-150587: Factor non-negative compact int subscript guards #153004https://github.com/python/cpython/pull/153004
KRRT7https://github.com/KRRT7
on May 29, 2026https://github.com/python/cpython/issues/150587#event-26125048713
pythongh-150587: Harden BINARY_OP_SUBSCR_LIST_INT/STORE_SUBSCR_LIST_I…https://github.com/KRRT7/cpython/commit/c006d4d612c3862a03cb40ca6fb38acd7847fdc7
pythongh-150587https://github.com/python/cpython/issues/150587
c006d4dhttps://github.com/KRRT7/cpython/commit/c006d4d612c3862a03cb40ca6fb38acd7847fdc7
pythongh-150587: Add blurbhttps://github.com/KRRT7/cpython/commit/03b4cddf833fac3d1e61a2df5aa7b003fd0c5eea
pythongh-150587https://github.com/python/cpython/issues/150587
03b4cddhttps://github.com/KRRT7/cpython/commit/03b4cddf833fac3d1e61a2df5aa7b003fd0c5eea
eendebakpthttps://github.com/eendebakpt
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
on May 29, 2026https://github.com/python/cpython/issues/150587#event-26127058645
https://github.com/KRRT7
KRRT7https://github.com/KRRT7
on May 30, 2026https://github.com/python/cpython/issues/150587#issuecomment-4582271624
#150425https://github.com/python/cpython/pull/150425
@ZeroIntensityhttps://github.com/ZeroIntensity
KRRT7https://github.com/KRRT7
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 30, 2026https://github.com/python/cpython/issues/150587#event-26139208924
picnixzhttps://github.com/picnixz
not plannedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on May 30, 2026https://github.com/python/cpython/issues/150587#event-26145042402
https://github.com/KRRT7
KRRT7https://github.com/KRRT7
on May 30, 2026https://github.com/python/cpython/issues/150587#issuecomment-4585060009
KRRT7https://github.com/KRRT7
on Jul 4, 2026https://github.com/python/cpython/issues/150587#event-27552531842
pythongh-150587: Guard specialized list-int subscript indiceshttps://github.com/KRRT7/cpython/commit/f1a230bff9c6083b8ae39d7f4981e91ec046256e
pythongh-150587https://github.com/python/cpython/issues/150587
f1a230bhttps://github.com/KRRT7/cpython/commit/f1a230bff9c6083b8ae39d7f4981e91ec046256e
https://github.com/KRRT7
KRRT7https://github.com/KRRT7
on Jul 4, 2026https://github.com/python/cpython/issues/150587#issuecomment-4881184127
gh-153004https://github.com/python/cpython/pull/153004
gh-150588https://github.com/python/cpython/pull/150588
gh-150425https://github.com/python/cpython/pull/150425
KRRT7https://github.com/KRRT7
on Jul 5, 2026https://github.com/python/cpython/issues/150587#event-27580453185
pythongh-150587: Use EXIT_IF for store subscript compact guardhttps://github.com/KRRT7/cpython/commit/a71df5eff4580404b9a542ba2245a82955f74292
pythongh-150587https://github.com/python/cpython/issues/150587
a71df5ehttps://github.com/KRRT7/cpython/commit/a71df5eff4580404b9a542ba2245a82955f74292
pythongh-150587: Regenerate opcode metadatahttps://github.com/KRRT7/cpython/commit/2413bac7166f384eb5f8edba55aa1a01515e28b6
pythongh-150587https://github.com/python/cpython/issues/150587
2413bachttps://github.com/KRRT7/cpython/commit/2413bac7166f384eb5f8edba55aa1a01515e28b6
pythongh-150587: Factor non-negative compact int subscript guardshttps://github.com/KRRT7/cpython/commit/12f8bf986e3b57be62c11034a2c4d307a8d50ef3
pythongh-150587https://github.com/python/cpython/issues/150587
12f8bf9https://github.com/KRRT7/cpython/commit/12f8bf986e3b57be62c11034a2c4d307a8d50ef3
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/150587
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/150587
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
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.