Skip to content

Commit 73302d3

Browse files
Improve pty.pyi (#6806)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 23e9d87 commit 73302d3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

stdlib/pty.pyi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import sys
22
from typing import Callable, Iterable
3+
from typing_extensions import Literal
34

45
if sys.platform != "win32":
6+
__all__ = ["openpty", "fork", "spawn"]
57
_Reader = Callable[[int], bytes]
68

7-
STDIN_FILENO: int
8-
STDOUT_FILENO: int
9-
STDERR_FILENO: int
9+
STDIN_FILENO: Literal[0]
10+
STDOUT_FILENO: Literal[1]
11+
STDERR_FILENO: Literal[2]
1012

11-
CHILD: int
13+
CHILD: Literal[0]
1214
def openpty() -> tuple[int, int]: ...
13-
def master_open() -> tuple[int, str]: ...
14-
def slave_open(tty_name: str) -> int: ...
15+
def master_open() -> tuple[int, str]: ... # deprecated, use openpty()
16+
def slave_open(tty_name: str) -> int: ... # deprecated, use openpty()
1517
def fork() -> tuple[int, int]: ...
1618
def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ...

0 commit comments

Comments
 (0)