This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients Eric Appelt, ned.deily, yselivanov
Date 2016-12-09.20:30:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481315430.83.0.111300852359.issue28091@psf.upfronthosting.co.za>
In-reply-to
Content
> 1. In PEP525 the documentation for aclose() is a bit terse and unclear to me. It appeared to suggest that you could catch GeneratorExit and yield, but I found this to result in a RuntimeError like a normal generator. I tried to document this as it actually behaves.

Yes, it should result in a RuntimeError. What PEP 525 is trying to explain is that it's OK to do this (although 'finally' is better):

   async def gen():
      try:
         yield
      except GeneratorExit:
         await smth()
         # using 'yield' here will trigger a RuntimeError
         raise

> 2. One thing that I noticed documented about normal generators is that they raise a ValueError if you try to run send() while another send() call is currently running. I verified this using threads. I looked into corresponding behavior for asynchronous generators, calling asend(), running the awaitable halfway through, and then calling asend() again to get a second awaitable before the first one finished. Asyncio seems to prevent more than one awaitable from a single async generator running at the same time, but I couldn't figure out how. Running some coroutines "by hand" calling asend() and send(), I was permitted to run multiple awaitables concurrently which produced odd results.

Interesting.  This is something that has to be fixed (in 3.6.1)
History
Date User Action Args
2016-12-09 20:30:30yselivanovsetrecipients: + yselivanov, ned.deily, Eric Appelt
2016-12-09 20:30:30yselivanovsetmessageid: <1481315430.83.0.111300852359.issue28091@psf.upfronthosting.co.za>
2016-12-09 20:30:30yselivanovlinkissue28091 messages
2016-12-09 20:30:30yselivanovcreate