summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/taskgroups.py
diff options
context:
space:
mode:
authorThomas Grainger <tagrain@gmail.com>2025-05-05 04:58:07 (GMT)
committerGitHub <noreply@github.com>2025-05-05 04:58:07 (GMT)
commit08d7687094c6acb8c2ea1925a292a94ce1246c82 (patch)
treebaa7ba9c05f6a3c1f7577b844e18c73e6fded6ec /Lib/asyncio/taskgroups.py
parentc4cc5d58aee6a3be55a95efee6ec25d5774f7b5f (diff)
downloadcpython-08d7687094c6acb8c2ea1925a292a94ce1246c82.zip
cpython-08d7687094c6acb8c2ea1925a292a94ce1246c82.tar.gz
cpython-08d7687094c6acb8c2ea1925a292a94ce1246c82.tar.bz2
gh-128307: Support eager_start=<bool> in create_eager_task_factory and various create_task functions (#128306)
Some create_task() functions were changed from `name=None, context=None` to `**kwargs`. Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Diffstat (limited to 'Lib/asyncio/taskgroups.py')
-rw-r--r--Lib/asyncio/taskgroups.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/Lib/asyncio/taskgroups.py b/Lib/asyncio/taskgroups.py
index 1633478..00e8f6d 100644
--- a/Lib/asyncio/taskgroups.py
+++ b/Lib/asyncio/taskgroups.py
@@ -179,7 +179,7 @@ class TaskGroup:
exc = None
- def create_task(self, coro, *, name=None, context=None):
+ def create_task(self, coro, **kwargs):
"""Create a new task in this group and return it.
Similar to `asyncio.create_task`.
@@ -193,10 +193,7 @@ class TaskGroup:
if self._aborting:
coro.close()
raise RuntimeError(f"TaskGroup {self!r} is shutting down")
- if context is None:
- task = self._loop.create_task(coro, name=name)
- else:
- task = self._loop.create_task(coro, name=name, context=context)
+ task = self._loop.create_task(coro, **kwargs)
futures.future_add_to_awaited_by(task, self._parent_task)