-
-
Notifications
You must be signed in to change notification settings - Fork 35k
bpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() #4799
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
28 commits
Select commit
Hold shift + click to select a range
71c327e
Proof of concept
asvetlov a384a51
Move functions into base_tasks.py
asvetlov c9647a7
Use WeakKeyDictionary for _all_tasks
asvetlov 9888405
Polish implementation
asvetlov 8897fd8
Merge remote-tracking branch 'upstream/master' into current_task2
asvetlov a4d01b8
Fix C Acceleration
asvetlov 8bf63f3
Add tests for deprecation
asvetlov 9d205dd
Make C Accelerators for _register_task, _enter_task and _leave_task
asvetlov 96ba687
Move pythod fallbacks back to base_tasks.py
asvetlov dda83b1
Add tests
asvetlov 5a8e598
Add NEWS entry
asvetlov c3b1794
Fix test name duplication.
asvetlov 3889ac0
Address comments
asvetlov df7ac0b
Add new tests
asvetlov a19c67f
Improve C Accelerator
asvetlov 998f316
Improve tests
asvetlov a36ca8a
Merge remote-tracking branch 'upstream/master' into current_task2
asvetlov 5b1cfc2
Reorganize imports
asvetlov 4cdfd0a
Refactor code
asvetlov ff5cf49
Merge remote-tracking branch 'upstream/master' into current_task2
asvetlov 1c7f5c2
Add missing decref
asvetlov 9abbb89
Reorganize code
asvetlov 8430283
Add docs/docstrings
asvetlov 5fdc96a
Merge remote-tracking branch 'upstream/master' into current_task2
asvetlov ee26922
Merge remote-tracking branch 'upstream/master' into current_task2
asvetlov 21cbb06
Fix notes
asvetlov 85059e5
Fix hash calculation errors
asvetlov 06a57d8
Fix markup
asvetlov 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
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.
You should keep
get_event_loop()here for backwards compatibility. So that code that callsTask.all_tasks()before a loop is created continues to work in 3.7 (although it will raise a warning).asyncio.all_tasks()should useget_running_loop().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.
Not sure about
asyncio.all_tasks()-- calling the function outside of coroutine context might make sense.RuntimeErrorfromasyncio.current_task()is more reasonable but I not sure again.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.
Then pass a loop object explicitly. The problem with
get_event_loop()is that it can create a new loop object implicitly. Or it may fail at creating it -- that function is weird.