gh-100344: Add C implementation for asyncio.current_task (#100345)

Co-authored-by: pranavtbhat
This commit is contained in:
Itamar Ostricher 2022-12-22 15:38:12 +02:00 committed by GitHub
parent aa878f086b
commit 4cc63e0d4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 123 additions and 9 deletions

View file

@ -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