Title: Async generator might re-throw GeneratorExit on aclose()
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: vxgmichel
Priority: normal Keywords: patch

Created on 2018-12-04 13:21 by vxgmichel, last changed 2019-07-13 16:04 by vxgmichel.

File name Uploaded Description Edit vxgmichel, 2018-12-04 13:21 Reproduce the issue with asyncio vxgmichel, 2018-12-04 13:22 Reproduce the issue without asyncio
patch.diff vxgmichel, 2018-12-04 13:22 A possible fix
Pull Requests
URL Status Linked Edit
PR 14755 open vxgmichel, 2019-07-13 16:04
Messages (1)
msg331043 - (view) Author: Vincent Michel (vxgmichel) * Date: 2018-12-04 13:21
As far as I can tell, this issue is different than:

I noticed `async_gen.aclose()` raises a GeneratorExit exception if the async generator finalization awaits and silence a failing unfinished future (see

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

Attached is a possible patch, although I'm not too comfortable messing with the python C internals. I can make a PR if necessary.
Date User Action Args
2019-07-13 16:04:04vxgmichelsetstage: patch review
pull_requests: + pull_request14550
2018-12-04 13:22:28vxgmichelsetfiles: + patch.diff
keywords: + patch
2018-12-04 13:22:10vxgmichelsetfiles: +
2018-12-04 13:21:20vxgmichelcreate