[New-bugs-announce] [issue28721] Fix asynchronous generators athrow() and aclose() to handle StopAsyncIteration

Yury Selivanov report at bugs.python.org
Wed Nov 16 18:12:03 EST 2016


New submission from Yury Selivanov:

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

----------
assignee: yselivanov
components: Interpreter Core
files: agen.patch
keywords: patch
messages: 281008
nosy: ned.deily, yselivanov
priority: release blocker
severity: normal
stage: commit review
status: open
title: Fix asynchronous generators athrow() and aclose() to handle StopAsyncIteration
type: behavior
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45514/agen.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28721>
_______________________________________


More information about the New-bugs-announce mailing list