mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
gh-100344: Add C implementation for asyncio.current_task
(#100345)
Co-authored-by: pranavtbhat
This commit is contained in:
parent
aa878f086b
commit
4cc63e0d4e
6 changed files with 123 additions and 9 deletions
|
@ -964,6 +964,7 @@ def _unregister_task(task):
|
|||
_all_tasks.discard(task)
|
||||
|
||||
|
||||
_py_current_task = current_task
|
||||
_py_register_task = _register_task
|
||||
_py_unregister_task = _unregister_task
|
||||
_py_enter_task = _enter_task
|
||||
|
@ -973,10 +974,12 @@ _py_leave_task = _leave_task
|
|||
try:
|
||||
from _asyncio import (_register_task, _unregister_task,
|
||||
_enter_task, _leave_task,
|
||||
_all_tasks, _current_tasks)
|
||||
_all_tasks, _current_tasks,
|
||||
current_task)
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
_c_current_task = current_task
|
||||
_c_register_task = _register_task
|
||||
_c_unregister_task = _unregister_task
|
||||
_c_enter_task = _enter_task
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue