diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index a83bde62a..b658ca2a7 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -1056,3 +1056,19 @@ if sys.version_info >= (3, 12) and sys.platform == "win32": def listdrives() -> list[str]: ... def listmounts(volume: str) -> list[str]: ... def listvolumes() -> list[str]: ... + +if sys.version_info >= (3, 12) and sys.platform == "linux": + CLONE_FILES: int + CLONE_FS: int + CLONE_NEWCGROUP: int + CLONE_NEWIPC: int + CLONE_NEWNET: int + CLONE_NEWNS: int + CLONE_NEWPID: int + CLONE_NEWTIME: int + CLONE_NEWUSER: int + CLONE_NEWUTS: int + CLONE_SIGHAND: int + CLONE_SYSVSEM: int + CLONE_THREAD: int + CLONE_VM: int diff --git a/stdlib/posix.pyi b/stdlib/posix.pyi index ffd967575..b6803ca68 100644 --- a/stdlib/posix.pyi +++ b/stdlib/posix.pyi @@ -314,6 +314,24 @@ if sys.platform != "win32": if sys.platform != "darwin": from os import RWF_DSYNC as RWF_DSYNC, RWF_HIPRI as RWF_HIPRI, RWF_NOWAIT as RWF_NOWAIT, RWF_SYNC as RWF_SYNC + if sys.version_info >= (3, 12) and sys.platform == "linux": + from os import ( + CLONE_FILES as CLONE_FILES, + CLONE_FS as CLONE_FS, + CLONE_NEWCGROUP as CLONE_NEWCGROUP, + CLONE_NEWIPC as CLONE_NEWIPC, + CLONE_NEWNET as CLONE_NEWNET, + CLONE_NEWNS as CLONE_NEWNS, + CLONE_NEWPID as CLONE_NEWPID, + CLONE_NEWTIME as CLONE_NEWTIME, + CLONE_NEWUSER as CLONE_NEWUSER, + CLONE_NEWUTS as CLONE_NEWUTS, + CLONE_SIGHAND as CLONE_SIGHAND, + CLONE_SYSVSEM as CLONE_SYSVSEM, + CLONE_THREAD as CLONE_THREAD, + CLONE_VM as CLONE_VM, + ) + # Not same as os.environ or os.environb # Because of this variable, we can't do "from posix import *" in os/__init__.pyi environ: dict[bytes, bytes] diff --git a/tests/stubtest_allowlists/linux-py312.txt b/tests/stubtest_allowlists/linux-py312.txt index c99a5d16d..f22872fb6 100644 --- a/tests/stubtest_allowlists/linux-py312.txt +++ b/tests/stubtest_allowlists/linux-py312.txt @@ -1,18 +1,5 @@ _?curses.color_pair _posixsubprocess.fork_exec -(os|posix).CLONE_FILES -(os|posix).CLONE_FS -(os|posix).CLONE_NEWCGROUP -(os|posix).CLONE_NEWIPC -(os|posix).CLONE_NEWNET -(os|posix).CLONE_NEWNS -(os|posix).CLONE_NEWPID -(os|posix).CLONE_NEWUSER -(os|posix).CLONE_NEWUTS -(os|posix).CLONE_SIGHAND -(os|posix).CLONE_SYSVSEM -(os|posix).CLONE_THREAD -(os|posix).CLONE_VM (os|posix).EFD_CLOEXEC (os|posix).EFD_NONBLOCK (os|posix).EFD_SEMAPHORE @@ -40,3 +27,7 @@ tty.__all__ tty.cfmakecbreak tty.cfmakeraw xxlimited.Xxo.x_exports + +# Exists on some Linux builds, and is documented, +# but is unavailable in Github Actions on Linux with Python 3.12 +(os|posix).CLONE_NEWTIME