Skip to content

[3.15] gh-160299: Preserve references from inlined comprehensions (GH-156819) - #160413

Merged
carljm merged 1 commit into
python:3.15from
carljm:cjm/gh-160299-symtable-references-315
Oct 23, 2026
Merged

carljm merged 1 commit into
python:3.15from
carljm:cjm/gh-160299-symtable-references-315

Conversation

@carljm

@carljm carljm commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Backports a narrow fix for #160299 to Python 3.15: local and nonlocal names in function scopes are now marked as referenced when their only uses are in inlined comprehensions.

The more comprehensive fix in #156819 is not backportable because it changes comprehension scope representation and compilation. This adapts only the reference-flag propagation, preserving 3.15's existing symbol-table structure.

…ns (pythonGH-156819)

Adapt the reference-flag propagation from pythonGH-156819 to fix pythongh-160299 without backporting the comprehensive changes to comprehension scope representation and compilation.
@carljm carljm added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.15 bugs and security fixes labels Oct 23, 2026
@carljm
carljm requested a review from iritkatriel October 23, 2026 04:41
@carljm
carljm marked this pull request as ready for review October 23, 2026 05:16
@carljm
carljm requested a review from JelleZijlstra as a code owner October 23, 2026 05:16
@carljm
carljm merged commit cc3a0c9 into python:3.15 Oct 23, 2026
66 checks passed
@bedevere-app

bedevere-app Bot commented Oct 23, 2026

Copy link
Copy Markdown

GH-160457 is a backport of this pull request to the 3.14 branch.

carljm added a commit that referenced this pull request Oct 23, 2026
…-160413) (#160457)

Adapt the reference-flag propagation from GH-156819 to fix gh-160299 without backporting the comprehensive changes to comprehension scope representation and compilation.

(cherry picked from commit cc3a0c9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.15 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants