Skip to content

[mypyc] Fix over-decref in async for over a non-async iterable - #22208

Merged
JukkaL merged 2 commits into
masterfrom
mypyc-fix-decref
Oct 15, 2026
Merged

JukkaL merged 2 commits into
masterfrom
mypyc-fix-decref

Conversation

@JukkaL

@JukkaL JukkaL commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

CPy_GetAIter called Py_DECREF on its argument when the object has no __aiter__. The code was adapted from ceval.c, where GET_AITER owns the stack reference, but the primitive receives a borrowed reference, so each failing 'async for' freed the iterable one reference too early and could later segfault.

CPy_GetAIter called Py_DECREF on its argument when the object has no
`__aiter__`. The code was adapted from ceval.c, where GET_AITER owns the
stack reference, but the primitive receives a borrowed reference, so
each failing 'async for' freed the iterable one reference too early
and could later segfault.
@JukkaL

JukkaL commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator Author

#22209 should fix the CI failures.

@JukkaL
JukkaL merged commit 491f77c into master Oct 15, 2026
18 checks passed
@JukkaL
JukkaL deleted the mypyc-fix-decref branch October 15, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants