Skip to content

Commit 555c1fe

Browse files
aiskJelleZijlstra
andauthored
stdlib: Add Shutdown error and shutdown method to queue module (#11489)
Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent 19d1b68 commit 555c1fe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

stdlib/queue.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ _T = TypeVar("_T")
1212
class Empty(Exception): ...
1313
class Full(Exception): ...
1414

15+
if sys.version_info >= (3, 13):
16+
class ShutDown(Exception): ...
17+
1518
class Queue(Generic[_T]):
1619
maxsize: int
1720

@@ -20,6 +23,8 @@ class Queue(Generic[_T]):
2023
not_full: Condition # undocumented
2124
all_tasks_done: Condition # undocumented
2225
unfinished_tasks: int # undocumented
26+
if sys.version_info >= (3, 13):
27+
is_shutdown: bool # undocumented
2328
# Despite the fact that `queue` has `deque` type,
2429
# we treat it as `Any` to allow different implementations in subtypes.
2530
queue: Any # undocumented
@@ -29,6 +34,9 @@ class Queue(Generic[_T]):
2934
def full(self) -> bool: ...
3035
def get(self, block: bool = True, timeout: float | None = None) -> _T: ...
3136
def get_nowait(self) -> _T: ...
37+
if sys.version_info >= (3, 13):
38+
def shutdown(self, immediate: bool = False) -> None: ...
39+
3240
def _get(self) -> _T: ...
3341
def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
3442
def put_nowait(self, item: _T) -> None: ...

0 commit comments

Comments
 (0)