Add os.unshare clone flags for Linux, Python 3.12+ (#10757)

This commit is contained in:
Amin Alaee
2023-09-24 17:23:30 +02:00
committed by GitHub
parent 8c4dd38840
commit 0a92429627
3 changed files with 38 additions and 13 deletions

View File

@@ -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

View File

@@ -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]

View File

@@ -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