[New-bugs-announce] [issue35409] Async generator might re-throw GeneratorExit on aclose()
report at bugs.python.org
Tue Dec 4 08:21:20 EST 2018
New submission from Vincent Michel <vxgmichel at gmail.com>:
As far as I can tell, this issue is different than: https://bugs.python.org/issue34730
I noticed `async_gen.aclose()` raises a GeneratorExit exception if the async generator finalization awaits and silence a failing unfinished future (see example.py).
This seems to be related to a bug in `async_gen_athrow_throw`. In fact, `async_gen.aclose().throw(exc)` does not silence GeneratorExit exceptions. This behavior can be reproduced without asyncio (see test.py).
Attached is a possible patch, although I'm not too comfortable messing with the python C internals. I can make a PR if necessary.
components: Interpreter Core
title: Async generator might re-throw GeneratorExit on aclose()
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47972/example.py
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce