Skip to content

Commit 6afb25f

Browse files
authored
Discard changes to Lib/asyncio/taskgroups.py
1 parent 02fe718 commit 6afb25f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/asyncio/taskgroups.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ async def _aexit(self, et, exc):
178178
exc = None
179179

180180

181-
def create_task(self, coro, **kwargs):
181+
def create_task(self, coro, *, name=None, context=None):
182182
"""Create a new task in this group and return it.
183183
184184
Similar to `asyncio.create_task`.
@@ -192,8 +192,10 @@ def create_task(self, coro, **kwargs):
192192
if self._aborting:
193193
coro.close()
194194
raise RuntimeError(f"TaskGroup {self!r} is shutting down")
195-
196-
task = self._loop.create_task(coro, **kwargs)
195+
if context is None:
196+
task = self._loop.create_task(coro, name=name)
197+
else:
198+
task = self._loop.create_task(coro, name=name, context=context)
197199

198200
# optimization: Immediately call the done callback if the task is
199201
# already done (e.g. if the coro was able to complete eagerly),

0 commit comments

Comments
 (0)