From 304b8e962693c5fc498c18296796d271f78d7578 Mon Sep 17 00:00:00 2001 From: Max Muoto Date: Sat, 20 Jul 2024 14:26:35 -0500 Subject: [PATCH] Add missing posix functions for 3.13 (#12375) --- stdlib/@tests/stubtest_allowlists/darwin-py313.txt | 8 -------- stdlib/@tests/stubtest_allowlists/linux-py313.txt | 8 -------- stdlib/os/__init__.pyi | 6 ++++++ stdlib/posix.pyi | 3 +++ 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt index 7d33095e7..15ae29d08 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py313.txt @@ -5,15 +5,7 @@ fcntl.F_OFD_SETLK fcntl.F_OFD_SETLKW fcntl.F_RDAHEAD fcntl.F_SETNOSIGPIPE -os.grantpt -os.posix_openpt -os.ptsname -os.unlockpt -posix.grantpt -posix.posix_openpt -posix.ptsname posixpath.splitroot -posix.unlockpt posix.waitid posix.waitid_result readline.backend diff --git a/stdlib/@tests/stubtest_allowlists/linux-py313.txt b/stdlib/@tests/stubtest_allowlists/linux-py313.txt index 07d3d589c..15fbea780 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py313.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py313.txt @@ -23,30 +23,22 @@ os.TFD_CLOEXEC os.TFD_NONBLOCK os.TFD_TIMER_ABSTIME os.TFD_TIMER_CANCEL_ON_SET -os.grantpt -os.posix_openpt -os.ptsname os.timerfd_create os.timerfd_gettime os.timerfd_gettime_ns os.timerfd_settime os.timerfd_settime_ns -os.unlockpt posix.POSIX_SPAWN_CLOSEFROM posix.TFD_CLOEXEC posix.TFD_NONBLOCK posix.TFD_TIMER_ABSTIME posix.TFD_TIMER_CANCEL_ON_SET -posix.grantpt -posix.posix_openpt -posix.ptsname posixpath.splitroot posix.timerfd_create posix.timerfd_gettime posix.timerfd_gettime_ns posix.timerfd_settime posix.timerfd_settime_ns -posix.unlockpt readline.backend stat.SF_SUPPORTED stat.SF_SYNTHETIC diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 1d97852dd..143dc1cc4 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -1156,3 +1156,9 @@ if sys.version_info >= (3, 12) and sys.platform == "linux": CLONE_VM: int def unshare(flags: int) -> None: ... def setns(fd: FileDescriptorLike, nstype: int = 0) -> None: ... + +if sys.version_info >= (3, 13) and sys.platform != "win32": + def posix_openpt(oflag: int, /) -> int: ... + def grantpt(fd: FileDescriptorLike, /) -> None: ... + def unlockpt(fd: FileDescriptorLike, /) -> None: ... + def ptsname(fd: FileDescriptorLike, /) -> str: ... diff --git a/stdlib/posix.pyi b/stdlib/posix.pyi index b31b8f3d3..30afc2b6e 100644 --- a/stdlib/posix.pyi +++ b/stdlib/posix.pyi @@ -236,6 +236,9 @@ if sys.platform != "win32": if sys.version_info >= (3, 11): from os import login_tty as login_tty + if sys.version_info >= (3, 13): + from os import grantpt as grantpt, posix_openpt as posix_openpt, ptsname as ptsname, unlockpt as unlockpt + if sys.platform != "linux": from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod