Skip to content

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

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

carljm merged 1 commit into
python:3.14from
carljm:cjm/gh-160299-symtable-references-314

Conversation

@carljm

@carljm carljm commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Backports #160413 to Python 3.14, fixing #160299: 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 backports the same narrow reference-flag fix as #160413, preserving 3.14's existing symbol-table structure.

(cherry picked from commit cc3a0c9)

…ns (pythonGH-160413)

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

(cherry picked from commit cc3a0c9)
@carljm carljm added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.14 bugs and security fixes labels Oct 23, 2026
@carljm
carljm requested a review from iritkatriel October 23, 2026 18:02
@carljm
carljm marked this pull request as ready for review October 23, 2026 18:12
@carljm
carljm requested a review from JelleZijlstra as a code owner October 23, 2026 18:12
@carljm
carljm enabled auto-merge (squash) October 23, 2026 18:12
@carljm
carljm merged commit 9eab48a into python:3.14 Oct 23, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.14 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.

2 participants