classification
Title: Fix asynchronous generators athrow() and aclose() to handle StopAsyncIteration
Type: behavior Stage: commit review
Components: Interpreter Core Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: yselivanov Nosy List: ned.deily, python-dev, yselivanov
Priority: release blocker Keywords: patch

Created on 2016-11-16 23:12 by yselivanov, last changed 2017-03-31 16:36 by dstufft. This issue is now closed.

Files
File name Uploaded Description Edit
agen.patch yselivanov, 2016-11-16 23:12 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017-03-31 16:36
Messages (2)
msg281008 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-11-16 23:12
1. aclose() should not propagate StopAsyncIteration:

  async def agen():
     try:
        yield
     except: 
        pass
  gen = agen()
  await agen.asend(None)
  await agen.aclose()  # <- this shouldn't raise StopAsyncIteration

2. athrow() should propagate StopAsyncIteration when the exception was swallowed by the generator and it returned:

  async def agen():
     try:
        yield
     except: 
        pass
  gen = agen()
  await agen.asend(None)
  await agen.athrow(ValueError)  # <- this should raise StopAsyncIteration
msg281009 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-16 23:16
New changeset 0f12a1d3a737 by Yury Selivanov in branch '3.6':
Issue #28721: Fix asynchronous generators aclose() and athrow()
https://hg.python.org/cpython/rev/0f12a1d3a737

New changeset 22cd78026ad1 by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28721)
https://hg.python.org/cpython/rev/22cd78026ad1
History
Date User Action Args
2017-03-31 16:36:18dstufftsetpull_requests: + pull_request925
2016-11-16 23:26:54yselivanovsetstatus: open -> closed
resolution: fixed
2016-11-16 23:16:56python-devsetnosy: + python-dev
messages: + msg281009
2016-11-16 23:12:03yselivanovcreate