Skip to content

Commit 464bd49

Browse files
committed
restore C task
1 parent a6e68bc commit 464bd49

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Lib/asyncio/tasks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ def __wakeup(self, future):
366366
_PyTask = Task
367367

368368

369-
# try:
370-
# import _asyncio
371-
# except ImportError:
372-
# pass
373-
# else:
374-
# # _CTask is needed for tests.
375-
# Task = _CTask = _asyncio.Task
369+
try:
370+
import _asyncio
371+
except ImportError:
372+
pass
373+
else:
374+
# _CTask is needed for tests.
375+
Task = _CTask = _asyncio.Task
376376

377377

378378
def create_task(coro, *, name=None, context=None):

async_tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def counting_task_constructor(coro, *, loop=None, name=None, context=None, yield
151151
# only count calls that will actually result a task scheduled to the event loop
152152
# (if yield_result is non-None, it will return synchronously)
153153
self.task_count += 1
154-
return asyncio.Task(coro, loop=loop, name=name, context=context, yield_result=yield_result)
154+
return asyncio.tasks._PyTask(coro, loop=loop, name=name, context=context, yield_result=yield_result)
155155

156156
def counting_task_factory(loop, coro, *, name=None, context=None, yield_result=None):
157157
return counting_task_constructor(coro, loop=loop, name=name, context=context, yield_result=yield_result)

0 commit comments

Comments
 (0)