Skip to content

Commit

Permalink
Update tty to python 3.12 (#10784)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Sep 27, 2023
1 parent ec52bf1 commit 4dad531
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 10 additions & 1 deletion stdlib/tty.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import sys
from typing import IO
from typing import IO, Any
from typing_extensions import TypeAlias

if sys.platform != "win32":
__all__ = ["setraw", "setcbreak"]
if sys.version_info >= (3, 12):
__all__ += ["cfmakeraw", "cfmakecbreak"]

_FD: TypeAlias = int | IO[str]

Expand All @@ -17,3 +19,10 @@ if sys.platform != "win32":
CC: int
def setraw(fd: _FD, when: int = 2) -> None: ...
def setcbreak(fd: _FD, when: int = 2) -> None: ...

if sys.version_info >= (3, 12):
# It is: `list[int, int, int, int, int, int, list[str]]
_Mode: TypeAlias = list[Any]

def cfmakeraw(mode: _Mode) -> None: ...
def cfmakecbreak(mode: _Mode) -> None: ...
3 changes: 0 additions & 3 deletions tests/stubtest_allowlists/darwin-py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ _curses.window.get_wch
_posixsubprocess.fork_exec
curses.unget_wch
curses.window.get_wch
tty.__all__
tty.cfmakecbreak
tty.cfmakeraw
xxlimited.Xxo.x_exports

(dbm.gnu)?
Expand Down
3 changes: 0 additions & 3 deletions tests/stubtest_allowlists/linux-py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ mmap.MAP_STACK
resource.prlimit
signal.sigtimedwait
signal.sigwaitinfo
tty.__all__
tty.cfmakecbreak
tty.cfmakeraw
xxlimited.Xxo.x_exports

# Exists on some Linux builds, and is documented,
Expand Down

0 comments on commit 4dad531

Please sign in to comment.