René's URL Explorer Experiment


Title: Remove private comprehension flags by YangSiJun528 · Pull Request #8537 · RustPython/RustPython · GitHub

Open Graph Title: Remove private comprehension flags by YangSiJun528 · Pull Request #8537 · RustPython/RustPython

X Title: Remove private comprehension flags by YangSiJun528 · Pull Request #8537 · RustPython/RustPython

Description: This PR follows our AI policy Summary Remove the RustPython-only ASSIGNED_IN_COMPREHENSION and ITER flags in favor of existing definition flags. Preserve both assignment-expression/iterator conflicts and inlined-comprehension behavior. Fix class-mangled conflict diagnostics and enable the existing test. Rationale ASSIGNED_IN_COMPREHENSION and ITER duplicate facts already represented by the existing definition flags. They also occupy bit positions reserved for packed scope information. Removing these private flags makes that range available for scope packing without losing the comprehension conflict checks. CPython reference CPython 3.14.7 handles both conflict directions using existing flags: symtable_add_def_helper() rejects an iterator target already marked DEF_GLOBAL or DEF_NONLOCAL, then records valid targets with DEF_COMP_ITER. symtable_extend_namedexpr_scope() rejects a named-expression target already marked DEF_LOCAL | DEF_COMP_ITER, otherwise propagating DEF_GLOBAL or DEF_NONLOCAL into the comprehension scope. The inlined-comprehension path is unchanged: every iterator target marked with ITER was already DEF_LOCAL, so checking DEF_LOCAL alone selects the same locals for save/restore. Additionally, this PR fixes a small diagnostic bug found while updating these checks: lookup still uses the mangled key, while errors now show the identifier as written in the source. This enables the existing mangled-name diagnostic test. Validation Passed pre-commit, workspace and C-API tests, and all 74 test_named_expressions tests. Follow-up A follow-up PR will build on this change to enable more test_symtable tests. AI assistance Codex (GPT-5.6 Sol) was used to investigate the symbol-table control flow, compare it with CPython, and implement this change. I reviewed the diff and the validation results above. Summary by CodeRabbit Bug Fixes Improved scope handling for comprehension iteration variables. Fixed name resolution for named expressions used within comprehensions. Improved detection of conflicting declarations in nested loops. Prevented internal symbol classification from causing incorrect compilation behavior.

Open Graph Description: This PR follows our AI policy Summary Remove the RustPython-only ASSIGNED_IN_COMPREHENSION and ITER flags in favor of existing definition flags. Preserve both assignment-expression/iterator confl...

X Description: This PR follows our AI policy Summary Remove the RustPython-only ASSIGNED_IN_COMPREHENSION and ITER flags in favor of existing definition flags. Preserve both assignment-expression/iterator confl...

Opengraph URL: https://github.com/RustPython/RustPython/pull/8537

X: @github

direct link

Domain: github.com

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:9bff68e5-4108-6d3e-6a8a-bc11378c1042
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB630:11EACE:36044A5:4817F7F:6B020780
html-safe-nonce5c53b2dc60e85f1806f5c68169a51856b55fb14ac76a2424026a9c6ae7a6b46d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjMwOjExRUFDRTozNjA0NEE1OjQ4MTdGN0Y6NkIwMjA3ODAiLCJ2aXNpdG9yX2lkIjoiMTgyOTAwNzc1NzQ2Mjg2NTc5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaccbd9be37c000078386ed1456d2a8d2faab92a7c73a27df918853aaf21e96aa01
hovercard-subject-tagpull_request:4286391184
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/RustPython/RustPython/pull/8537/files
twitter:imagehttps://avatars.githubusercontent.com/u/80192911?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/80192911?s=400&v=4
og:image:altThis PR follows our AI policy Summary Remove the RustPython-only ASSIGNED_IN_COMPREHENSION and ITER flags in favor of existing definition flags. Preserve both assignment-expression/iterator confl...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/8537/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F8537%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%2FRustPython%2FRustPython%2Fpull%2F8537%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=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/8537/files
Reloadhttps://github.com/RustPython/RustPython/pull/8537/files
Reloadhttps://github.com/RustPython/RustPython/pull/8537/files
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
YangSiJun528:remove-private-comprehension-flagshttps://github.com/YangSiJun528/RustPython/tree/remove-private-comprehension-flags
Conversation 4 https://github.com/RustPython/RustPython/pull/8537
Commits 3 https://github.com/RustPython/RustPython/pull/8537/commits
Checks 28 https://github.com/RustPython/RustPython/pull/8537/checks
Files changed https://github.com/RustPython/RustPython/pull/8537/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8537/files
Remove private comprehension flags https://github.com/RustPython/RustPython/pull/8537/files#top
Show all changes 3 commits https://github.com/RustPython/RustPython/pull/8537/files
9cf06c1 Remove the private assignment-expression marker YangSiJun528 Aug 4, 2026 https://github.com/RustPython/RustPython/pull/8537/commits/9cf06c14cf394d7389e7d7a209de1e2c26305d31
a7385d2 Remove the private comprehension iterator flag YangSiJun528 Aug 4, 2026 https://github.com/RustPython/RustPython/pull/8537/commits/a7385d22d46eebb9f6fe03edc387a926a2246c23
b7f4952 Preserve source names in named-expression diagnostics YangSiJun528 Aug 4, 2026 https://github.com/RustPython/RustPython/pull/8537/commits/b7f4952e4d25e28c10c62f10852a6fa133af3d31
Clear filters https://github.com/RustPython/RustPython/pull/8537/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8537/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8537/files
test_named_expressions.py https://github.com/RustPython/RustPython/pull/8537/files#diff-4a4a4c48508e5753e128a68e37d611bf80f7847375cfa8445eb32e44f96f604b
compile.rs https://github.com/RustPython/RustPython/pull/8537/files#diff-6a53a11ca0aa1a372032c6b54644b8cda74af0c771efa40d3668da4a042cf7ca
symboltable.rs https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
Lib/test/test_named_expressions.pyhttps://github.com/RustPython/RustPython/pull/8537/files#diff-4a4a4c48508e5753e128a68e37d611bf80f7847375cfa8445eb32e44f96f604b
View file https://github.com/YangSiJun528/RustPython/blob/b7f4952e4d25e28c10c62f10852a6fa133af3d31/Lib/test/test_named_expressions.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8537/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8537/files#diff-4a4a4c48508e5753e128a68e37d611bf80f7847375cfa8445eb32e44f96f604b
https://github.com/RustPython/RustPython/pull/8537/files#diff-4a4a4c48508e5753e128a68e37d611bf80f7847375cfa8445eb32e44f96f604b
crates/codegen/src/compile.rshttps://github.com/RustPython/RustPython/pull/8537/files#diff-6a53a11ca0aa1a372032c6b54644b8cda74af0c771efa40d3668da4a042cf7ca
View file https://github.com/YangSiJun528/RustPython/blob/b7f4952e4d25e28c10c62f10852a6fa133af3d31/crates/codegen/src/compile.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8537/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8537/files#diff-6a53a11ca0aa1a372032c6b54644b8cda74af0c771efa40d3668da4a042cf7ca
https://github.com/RustPython/RustPython/pull/8537/files#diff-6a53a11ca0aa1a372032c6b54644b8cda74af0c771efa40d3668da4a042cf7ca
crates/codegen/src/symboltable.rshttps://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
View file https://github.com/YangSiJun528/RustPython/blob/b7f4952e4d25e28c10c62f10852a6fa133af3d31/crates/codegen/src/symboltable.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8537/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
https://github.com/RustPython/RustPython/pull/8537/files#diff-7e251aa58ffb659d1cf1ee90837d9e467e5c3e1c699f5c1e42655c2f03489b12
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8537/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

Viewport: width=device-width


URLs of crawlers that visited me.