Skip to content

gh-151907: Reduce duplication in codegen comprehension functions - #154846

Open
cdce8p wants to merge 2 commits into
python:mainfrom
cdce8p:codegen-comprehension-reduce-duplication
Open

gh-151907: Reduce duplication in codegen comprehension functions#154846
cdce8p wants to merge 2 commits into
python:mainfrom
cdce8p:codegen-comprehension-reduce-duplication

Conversation

@cdce8p

@cdce8p cdce8p commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Noticed that #151908 updated both codegen_sync_comprehension_generator and codegen_async_comprehension_generator but missed a spot to use the "new" helper codegen_unpack_starred in the latter. After looking more closely into it, I noticed that a large part is actually identical between both functions. Moving it to a separate functions avoids any unintended differences between sync and async comprehensions just because on code path wasn't updated properly.

_Also added two assert(!avoid_creation); to the helper which were added to the async variant but missed for the sync one.

/CC @ZeroIntensity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant