Skip to content
Shihao Qi
Projects
Writing
Notes
Search
About
中
TAG
Streaming
Everything filed under this tag.
1 entries
01
Writing
Breaking Out of an Async Generator Triggers aclose(): Code After the Last Yield Never Runs
2026-11-07
The consumer breaks on the last event, the async generator gets aclose(), GeneratorExit is thrown into the suspended yield, and the create_task after it never runs while a finally would. Autarkia’s conversation-history save never ran once because of it; the pattern was fixed in April and reintroduced in August for a reasonable-sounding reason.
#Python
#asyncio
#Streaming
#Autarkia
← All tags
Search the site