Skip to content

Commit

Permalink
SimpleQueue and Empty live in _queue (#12979)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungol authored Nov 8, 2024
1 parent 951c0b8 commit 1c78402
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ multiprocessing.reduction.AbstractReducer.ForkingPickler
multiprocessing.pool.Pool.__del__

# C signature is broader than what is actually accepted
queue.SimpleQueue.__init__
_?queue.SimpleQueue.__init__

# Items that depend on the existence and flags of SSL
imaplib.IMAP4_SSL.ssl
Expand Down
1 change: 1 addition & 0 deletions stdlib/VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ _osx_support: 3.0-
_posixsubprocess: 3.2-
_py_abc: 3.7-
_pydecimal: 3.5-
_queue: 3.7-
_random: 3.0-
_sitebuiltins: 3.4-
_socket: 3.0- # present in 3.0 at runtime, but not in typeshed
Expand Down
20 changes: 20 additions & 0 deletions stdlib/_queue.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
from typing import Any, Generic, TypeVar

if sys.version_info >= (3, 9):
from types import GenericAlias

_T = TypeVar("_T")

class Empty(Exception): ...

class SimpleQueue(Generic[_T]):
def __init__(self) -> None: ...
def empty(self) -> bool: ...
def get(self, block: bool = True, timeout: float | None = None) -> _T: ...
def get_nowait(self) -> _T: ...
def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
def put_nowait(self, item: _T) -> None: ...
def qsize(self) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
13 changes: 1 addition & 12 deletions stdlib/queue.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from _queue import Empty as Empty, SimpleQueue as SimpleQueue
from threading import Condition, Lock
from typing import Any, Generic, TypeVar

Expand All @@ -11,7 +12,6 @@ if sys.version_info >= (3, 13):

_T = TypeVar("_T")

class Empty(Exception): ...
class Full(Exception): ...

if sys.version_info >= (3, 13):
Expand Down Expand Up @@ -55,14 +55,3 @@ class PriorityQueue(Queue[_T]):

class LifoQueue(Queue[_T]):
queue: list[_T]

class SimpleQueue(Generic[_T]):
def __init__(self) -> None: ...
def empty(self) -> bool: ...
def get(self, block: bool = True, timeout: float | None = None) -> _T: ...
def get_nowait(self) -> _T: ...
def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
def put_nowait(self, item: _T) -> None: ...
def qsize(self) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

0 comments on commit 1c78402

Please sign in to comment.