aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/asyncio/taskgroups.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/asyncio/taskgroups.py')
-rw-r--r--Lib/asyncio/taskgroups.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/asyncio/taskgroups.py b/Lib/asyncio/taskgroups.py
index 91be0decc41..cb9c1ce4d7d 100644
--- a/Lib/asyncio/taskgroups.py
+++ b/Lib/asyncio/taskgroups.py
@@ -158,10 +158,10 @@ class TaskGroup:
if self._aborting:
raise RuntimeError(f"TaskGroup {self!r} is shutting down")
if context is None:
- task = self._loop.create_task(coro)
+ task = self._loop.create_task(coro, name=name)
else:
- task = self._loop.create_task(coro, context=context)
- task.set_name(name)
+ task = self._loop.create_task(coro, name=name, context=context)
+
# optimization: Immediately call the done callback if the task is
# already done (e.g. if the coro was able to complete eagerly),
# and skip scheduling a done callback