Skip to content

Fix yield from not working on non-iterator iterables inside async generators#7

Merged
ZeroIntensity merged 1 commit intoZeroIntensity:async-yield-fromfrom
johnslavik:hyperawait-secret-conspiracy
Mar 7, 2026
Merged

Fix yield from not working on non-iterator iterables inside async generators#7
ZeroIntensity merged 1 commit intoZeroIntensity:async-yield-fromfrom
johnslavik:hyperawait-secret-conspiracy

Conversation

@johnslavik
Copy link

@johnslavik johnslavik commented Mar 7, 2026

Previously, this wouldn't work:

import asyncio

async def agen():
    yield from range(10)

async def main():
    [x async for x in agen()]  # ho ho is this a Prime reference

asyncio.run(main())

PyObject_GetIter increments iterable's refcount so I think we're game?

@ZeroIntensity ZeroIntensity merged commit 6145c26 into ZeroIntensity:async-yield-from Mar 7, 2026
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