Async generator closing doesn't match 3.13+
Author: ZeroIntensityCreated Sep 16, 2026Updated Sep 16, 2026
Labelsbug
Bug Report
Bug Description
There are a few edge cases when throwing into an async generator that result in some differences between Nuitka and CPython 3.13+.
️ Environment
1. Nuitka Version, Python Version, OS, and Platform
4.3rc1 Update status: newer than stable release '4.2.1' (cached, 30 minutes old). Commercial: None Python: 3.14.7 (main, Aug 10 2026, 07:46:56) [GCC 16.1.1 20260728] Flavor: Arch Python GIL: yes Executable: /usr/bin/python OS: Linux Arch: x86_64 Distribution: Arch None Version C compiler: gcc (gcc 16).
2. How Nuitka and Python were Installed
Source
3. Relevant PyPI Packages and Versions
N/A
️ To Reproduce
async def f():
yield
x = f().aclose()
try:
x.throw(GeneratorExit)
except StopIteration:
pass
# RuntimeError on CPython 3.13+, StopIteration on Nuitka
x.throw(GeneratorExit)Expected Behavior
Should match CPython on 3.13:
Traceback (most recent call last):
File "/home/peter/develop/nuitka/mro.py", line 15, in <module>
x.throw(GeneratorExit)
~~~~~~~^^^^^^^^^^^^^^^
RuntimeError: cannot reuse already awaited aclose()/athrow()Actual Behavior & Output
Traceback (most recent call last):
File "/home/peter/develop/nuitka/mro.py", line 15, in <module>
x.throw(GeneratorExit)
StopIteration↩️ Regression (if applicable)
This is the correct behavior for <3.13.
Additional Context (Optional)
Found while working on the 3.13 test suite.
Source: Nuitka/Nuitka