summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorItamar Ostricher <itamarost@gmail.com>2022-12-22 13:38:12 (GMT)
committerGitHub <noreply@github.com>2022-12-22 13:38:12 (GMT)
commit4cc63e0d4e4cf3299dcc0ea81616ba072ae5589d (patch)
treebf77b10edfc069076f1d014b4482ddeef6f4869d /Lib/asyncio
parentaa878f086b7ba8bdd7006d9d509c671167a5fb1e (diff)
downloadcpython-4cc63e0d4e4cf3299dcc0ea81616ba072ae5589d.zip
cpython-4cc63e0d4e4cf3299dcc0ea81616ba072ae5589d.tar.gz
cpython-4cc63e0d4e4cf3299dcc0ea81616ba072ae5589d.tar.bz2
gh-100344: Add C implementation for `asyncio.current_task` (#100345)
Co-authored-by: pranavtbhat
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/tasks.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index fa85328..e78719d 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -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