From: Guido van Rossum Date: Fri, 18 Feb 2022 05:30:44 +0000 (-0800) Subject: bpo-46752: Slight improvements to TaskGroup API (GH-31398) X-Git-Tag: v3.11.0a6~170 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d85121660ea50bbe8fbd31797aa6e4afe0850388;p=thirdparty%2FPython%2Fcpython.git bpo-46752: Slight improvements to TaskGroup API (GH-31398) * Remove task group names (for now) We're not sure that they are needed, and once in the code we would never be able to get rid of them. Yury wrote: > Ideally, there should be a way for someone to build a "trace" > of taskgroups/task leading to the current running task. > We could do that using contextvars, but I'm not sure we should > do that in 3.11. * Pass optional name on to task in create_task() * Remove a bunch of unused stuff --- diff --git a/Lib/asyncio/taskgroups.py b/Lib/asyncio/taskgroups.py index 718277892c51..57b0eafefc16 100644 --- a/Lib/asyncio/taskgroups.py +++ b/Lib/asyncio/taskgroups.py @@ -3,10 +3,6 @@ __all__ = ["TaskGroup"] -import itertools -import textwrap -import traceback -import types import weakref from . import events @@ -15,12 +11,7 @@ from . import tasks class TaskGroup: - def __init__(self, *, name=None): - if name is None: - self._name = f'tg-{_name_counter()}' - else: - self._name = str(name) - + def __init__(self): self._entered = False self._exiting = False self._aborting = False @@ -33,11 +24,8 @@ class TaskGroup: self._base_error = None self._on_completed_fut = None - def get_name(self): - return self._name - def __repr__(self): - msg = f'