diff --git a/pyproject.toml b/pyproject.toml index 2850ade6988c..359da460e249 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,7 @@ select = [ "PYI044", # `from __future__ import annotations` has no effect in stub files, since type checkers automatically treat stubs as having those semantics "PYI055", # Multiple `type[T]` usages in a union. Combine them into one, e.g., `type[{union_str}]`. "PYI058", # Use `{return_type}` as the return value for simple `{method}` methods - # "PYI059", # TODO: Add when dropping Python 3.9 support + "PYI059", # Checks for classes inheriting from typing.Generic[] where Generic[] is not the last base class in the bases tuple "PYI061", # Use `None` rather than `Literal[None]` "PYI062", # Duplicate literal member `{}` "PYI064", # `Final[Literal[{literal}]]` can be replaced with a bare Final diff --git a/stdlib/asyncio/queues.pyi b/stdlib/asyncio/queues.pyi index 2fa2226d0e6a..de19fa236ad3 100644 --- a/stdlib/asyncio/queues.pyi +++ b/stdlib/asyncio/queues.pyi @@ -4,10 +4,7 @@ from asyncio.events import AbstractEventLoop from types import GenericAlias from typing import Any, Generic, TypeVar -if sys.version_info >= (3, 10): - from .mixins import _LoopBoundMixin -else: - _LoopBoundMixin = object +from .mixins import _LoopBoundMixin class QueueEmpty(Exception): ... class QueueFull(Exception): ... @@ -24,9 +21,7 @@ _T = TypeVar("_T") if sys.version_info >= (3, 13): class QueueShutDown(Exception): ... -# If Generic[_T] is last and _LoopBoundMixin is object, pyright is unhappy. -# We can remove the noqa pragma when dropping 3.9 support. -class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059 +class Queue(_LoopBoundMixin, Generic[_T]): if sys.version_info >= (3, 10): def __init__(self, maxsize: int = 0) -> None: ... else: