-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-31861: Provide aiter and anext builtins #23847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
44b2a60
bpo-31861: Add operator.aiter and operator.anext
jab 142523b
address comments from first review
jab 3ebce05
Address new review comments + rebase
jab 2f8df99
improve tests
jab ad12116
Sketch out async iterator in C
lordmauve ce35092
Implement aiter() and anext() using sync methods only
lordmauve f9dc183
Add basic aiter built-in [WIP]
justin39 086bb79
Start aiter implementation
justin39 29ef712
Get test_asyncgen tests passing
justin39 331e80e
Fix awaitable iternext
justin39 95879d8
Add anext builtin
justin39 5b64589
Use stop iter functions for anext
justin39 6e145db
Use stop iter functions in aiter
justin39 2fd4be6
Note about implementing __reduce__ for aiter
justin39 430dd59
Refactor aiter and anext type names
justin39 4266e65
Add documentation for aiter()
justin39 ecbedc7
Update documentation for aiter and anext
justin39 5fa3812
Clean up docs and formatting
justin39 0f9c814
Remove async iterator code from operator.py
justin39 8160c82
Cleanup formatting
justin39 fa8b12a
Fix test_builtins_have_signatures + misc. cleanups
jab a2242d9
Use PyErr_SetNone now that we can
jab 3ce5675
whitespace
jab 0038cde
cosmetic fixes
jab 06019ea
Add null check and use StopAsyncIteration when aiter is exhausted
justin39 0cc00f2
Fix AC definition and resulting signature
justin39 8b8a689
Fix comparison to NULL instead of Py_None
justin39 894600d
Revert None deafult for aiter/anext and add whatsnew entry
justin39 e687d88
Merge branch 'master' of https://github.com/python/cpython into justi…
justin39 259af97
Delint tests + docs (fixes CI), alphabetize names.
jab 97d06e5
Merge branch 'master' into justin39/aiter-c
jab dd7c02d
Fix code style and comments.
jab 2fbdd5b
Remove 2-arg variant of aiter.
jab 009118c
Fix use of clinic.
jab 71fede3
Address some feedback from Guido's review.
jab 4a51ace
No longer need to exclude aiter from test_builtins_have_signatures.
jab 108e4a3
Improve aiter() docs.
jab 042f596
Fix typo.
jab 6ee8824
Add test_aiter_idempotent().
jab 6f50ef8
Remove public API added for anext.
jab ef40fb7
Slightly improve wording
gvanrossum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2018-08-24-01-08-09.bpo-31861.-q9RKJ.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Add builtins.aiter and builtins.anext. | ||
Patch by Joshua Bronson (@jab), Daniel Pope (@lordmauve), and Justin Wang (@justin39). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to add these to the public C API? Just because
PyObject_GetIter()
is public I'm not sure that the Aiter variant needs to be. @vstinner tends to push back on adding new things to the C API. @1st1 what do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind adding this function -- while somewhat trivial, it's something that projects like Cython (and potentially our own modules like
_asynciomodule.c
) have to reimplement.