Skip to content

Commit 4c61bdb

Browse files
authored
multiprocessing.pool: Use Literal and add __all__ (#6815)
1 parent 582f1e9 commit 4c61bdb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

stdlib/multiprocessing/pool.pyi

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import sys
22
from _typeshed import Self
33
from contextlib import AbstractContextManager
44
from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, TypeVar
5+
from typing_extensions import Literal
56

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

10+
__all__ = ["Pool", "ThreadPool"]
11+
912
_PT = TypeVar("_PT", bound=Pool)
1013
_S = TypeVar("_S")
1114
_T = TypeVar("_T")
@@ -115,11 +118,11 @@ class ThreadPool(Pool, AbstractContextManager[ThreadPool]):
115118

116119
# undocumented
117120
if sys.version_info >= (3, 8):
118-
INIT: str
119-
RUN: str
120-
CLOSE: str
121-
TERMINATE: str
121+
INIT: Literal["INIT"]
122+
RUN: Literal["RUN"]
123+
CLOSE: Literal["CLOSE"]
124+
TERMINATE: Literal["TERMINATE"]
122125
else:
123-
RUN: int
124-
CLOSE: int
125-
TERMINATE: int
126+
RUN: Literal[0]
127+
CLOSE: Literal[1]
128+
TERMINATE: Literal[2]

0 commit comments

Comments
 (0)