Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd the ability for @async_generator to produce a native async generator #17
Conversation
oremanj
requested a review
from
njsmith
Apr 5, 2018
This comment has been minimized.
This comment has been minimized.
codecov
bot
commented
Apr 5, 2018
•
Codecov Report
@@ Coverage Diff @@
## pr15-pr16-combined #17 +/- ##
==================================================
Coverage 100% 100%
==================================================
Files 7 7
Lines 991 1108 +117
Branches 78 100 +22
==================================================
+ Hits 991 1108 +117
Continue to review full report at Codecov.
|
added some commits
Apr 5, 2018
oremanj
referenced this pull request
May 2, 2018
Open
Make yield_ and yield_from_ interoperate with native async generators again #16
This comment has been minimized.
This comment has been minimized.
|
I originally made this maximally paranoid about the minor behavioral differences, but on reflection I'm not sure that level of paranoia is necessary -- I think it would reasonable to make |
This comment has been minimized.
This comment has been minimized.
|
See #16 (comment) for high-level review comments. |
oremanj commentedApr 5, 2018
This improves performance and offers cleaner tracebacks, although native generators continue to have the failure mode of https://bugs.python.org/issue32526 and to provide not-very-clear exception messages when they're misused.
Since the semantics of native async generators are slightly different, this change has
@async_generatorcontinue to produce an old-style pure-Python AsyncGenerator by default, with warnings if it looks like bpo-32526 would change the behavior of code that's using the async generator. Users can say@async_generator_legacyto continue to get the old behavior without the warnings, or@async_generator_nativeto use a native generator where available; my thought is that the next release of async_generator can make@async_generator_nativebe the default.Also add an
ag_awaitattribute to legacy async generators, to match the behavior of native ones.