Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions asyncer/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import sys
from collections.abc import Awaitable, Callable, Coroutine
from importlib import import_module
from types import TracebackType
from typing import (
Any,
Generic,
Literal,
ParamSpec,
TypeVar,
)
Expand Down Expand Up @@ -169,6 +171,16 @@ async def __aenter__(self) -> "TaskGroup": # pragma: nocover
"""Enter the task group context and allow starting new tasks."""
return await super().__aenter__() # type: ignore

# This is only for the return type annotation, but it won't really be called
async def __aexit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
exc_tb: TracebackType | None,
) -> Literal[False]: # pragma: nocover
"""Exit the task group context once all tasks are completed."""
return await super().__aexit__(exc_type, exc_value, exc_tb) # type: ignore


def create_task_group() -> "TaskGroup":
"""
Expand Down