Remove Python 3.8 exclusive branches from _asyncio, _blake2, _codecs, _contextvars (#13773)

Remove 3.8 exclusive branches from asyncio, _blake2, codecs, contextvars
This commit is contained in:
Brian Schubert
2025-04-02 09:13:26 -04:00
committed by GitHub
parent ad8ecaf217
commit 5d15355717
4 changed files with 49 additions and 124 deletions
+3 -8
View File
@@ -1,11 +1,8 @@
import sys
from collections.abc import Callable, Iterator, Mapping
from types import GenericAlias
from typing import Any, ClassVar, Generic, TypeVar, final, overload
from typing_extensions import ParamSpec, Self
if sys.version_info >= (3, 9):
from types import GenericAlias
_T = TypeVar("_T")
_D = TypeVar("_D")
_P = ParamSpec("_P")
@@ -27,8 +24,7 @@ class ContextVar(Generic[_T]):
def get(self, default: _D, /) -> _D | _T: ...
def set(self, value: _T, /) -> Token[_T]: ...
def reset(self, token: Token[_T], /) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
@final
class Token(Generic[_T]):
@@ -38,8 +34,7 @@ class Token(Generic[_T]):
def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express
MISSING: ClassVar[object]
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def copy_context() -> Context: ...