[New-bugs-announce] [issue35409] Async generator might re-throw GeneratorExit on aclose()

Vincent Michel 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
files: example.py
messages: 331043
nosy: vxgmichel
priority: normal
severity: normal
status: open
title: Async generator might re-throw GeneratorExit on aclose()
type: behavior
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>
<https://bugs.python.org/issue35409>
_______________________________________


More information about the New-bugs-announce mailing list