multiprocessing: Queue does not inherit from queues.Queue (#10104)

Fixes #3404
This commit is contained in:
Jelle Zijlstra
2023-04-29 07:39:11 -07:00
committed by GitHub
parent f42f665fa1
commit 40975222b4

View File

@@ -1,4 +1,3 @@
import queue
import sys
from typing import Any, Generic, TypeVar
@@ -9,19 +8,24 @@ __all__ = ["Queue", "SimpleQueue", "JoinableQueue"]
_T = TypeVar("_T")
class Queue(queue.Queue[_T]):
class Queue(Generic[_T]):
# FIXME: `ctx` is a circular dependency and it's not actually optional.
# It's marked as such to be able to use the generic Queue in __init__.pyi.
def __init__(self, maxsize: int = 0, *, ctx: Any = ...) -> None: ...
def get(self, block: bool = True, timeout: float | None = None) -> _T: ...
def put(self, obj: _T, block: bool = True, timeout: float | None = None) -> None: ...
def put_nowait(self, obj: _T) -> None: ...
def get(self, block: bool = True, timeout: float | None = None) -> _T: ...
def qsize(self) -> int: ...
def empty(self) -> bool: ...
def full(self) -> bool: ...
def get_nowait(self) -> _T: ...
def put_nowait(self, obj: _T) -> None: ...
def close(self) -> None: ...
def join_thread(self) -> None: ...
def cancel_join_thread(self) -> None: ...
class JoinableQueue(Queue[_T]): ...
class JoinableQueue(Queue[_T]):
def task_done(self) -> None: ...
def join(self) -> None: ...
class SimpleQueue(Generic[_T]):
def __init__(self, *, ctx: Any = ...) -> None: ...