From 3a4d751516325a0e98441315893bfa1f4b3acd6f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 16 Feb 2022 17:56:47 -0800 Subject: [PATCH 1/3] Remove TaskGroup name arg and get_name() method (We plan to remove those from the implementation.) --- stdlib/asyncio/taskgroups.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stdlib/asyncio/taskgroups.pyi b/stdlib/asyncio/taskgroups.pyi index 20b69fe435b8..3c3730569ed7 100644 --- a/stdlib/asyncio/taskgroups.pyi +++ b/stdlib/asyncio/taskgroups.pyi @@ -9,8 +9,7 @@ from .tasks import Task _T = TypeVar("_T") class TaskGroup: - def __init__(self, *, name: str | None = ...) -> None: ... - def get_name(self) -> str: ... + def __init__(self) -> None: ... async def __aenter__(self: Self) -> Self: ... async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... def create_task(self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T]) -> Task[_T]: ... From 96ee45f3ab3390616b33e0dbda66ed5c049a6769 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 17 Feb 2022 16:00:39 -0800 Subject: [PATCH 2/3] Add optional name arg to create_task() See https://github.com/python/cpython/pull/31398 --- stdlib/asyncio/taskgroups.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/asyncio/taskgroups.pyi b/stdlib/asyncio/taskgroups.pyi index 3c3730569ed7..25ee90ccb117 100644 --- a/stdlib/asyncio/taskgroups.pyi +++ b/stdlib/asyncio/taskgroups.pyi @@ -12,4 +12,4 @@ class TaskGroup: def __init__(self) -> None: ... async def __aenter__(self: Self) -> Self: ... async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... - def create_task(self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T]) -> Task[_T]: ... + def create_task(self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = None) -> Task[_T]: ... From 9567ef72e166457350abe9952fb66927b978d923 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 17 Feb 2022 16:03:55 -0800 Subject: [PATCH 3/3] Fix default (thanks, flake8) --- stdlib/asyncio/taskgroups.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/asyncio/taskgroups.pyi b/stdlib/asyncio/taskgroups.pyi index 25ee90ccb117..ce527e1e8158 100644 --- a/stdlib/asyncio/taskgroups.pyi +++ b/stdlib/asyncio/taskgroups.pyi @@ -12,4 +12,4 @@ class TaskGroup: def __init__(self) -> None: ... async def __aenter__(self: Self) -> Self: ... async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... - def create_task(self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = None) -> Task[_T]: ... + def create_task(self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ...) -> Task[_T]: ...