Add os.eventfd, os.eventfd_read and os.eventfd_write to Linux for Python 3.10+ (#10768)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Amin Alaee
2023-09-25 15:10:56 +02:00
committed by GitHub
parent cec86eb22e
commit e69545844b
5 changed files with 21 additions and 19 deletions

View File

@@ -2,6 +2,7 @@ import sys
from _typeshed import (
AnyStr_co,
BytesPath,
FileDescriptor,
FileDescriptorLike,
FileDescriptorOrPath,
GenericPath,
@@ -1057,6 +1058,14 @@ if sys.version_info >= (3, 12) and sys.platform == "win32":
def listmounts(volume: str) -> list[str]: ...
def listvolumes() -> list[str]: ...
if sys.version_info >= (3, 10) and sys.platform == "linux":
EFD_CLOEXEC: int
EFD_NONBLOCK: int
EFD_SEMAPHORE: int
def eventfd(initval: int, flags: int = 524288) -> FileDescriptor: ...
def eventfd_read(fd: FileDescriptor) -> int: ...
def eventfd_write(fd: FileDescriptor, value: int) -> None: ...
if sys.version_info >= (3, 12) and sys.platform == "linux":
CLONE_FILES: int
CLONE_FS: int
@@ -1072,3 +1081,4 @@ if sys.version_info >= (3, 12) and sys.platform == "linux":
CLONE_SYSVSEM: int
CLONE_THREAD: int
CLONE_VM: int
def unshare(flags: int) -> None: ...

View File

@@ -236,6 +236,16 @@ if sys.platform != "win32":
removexattr as removexattr,
setxattr as setxattr,
)
if sys.version_info >= (3, 10):
from os import (
EFD_CLOEXEC as EFD_CLOEXEC,
EFD_NONBLOCK as EFD_NONBLOCK,
EFD_SEMAPHORE as EFD_SEMAPHORE,
eventfd as eventfd,
eventfd_read as eventfd_read,
eventfd_write as eventfd_write,
)
else:
from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod
@@ -330,6 +340,7 @@ if sys.platform != "win32":
CLONE_SYSVSEM as CLONE_SYSVSEM,
CLONE_THREAD as CLONE_THREAD,
CLONE_VM as CLONE_VM,
unshare as unshare,
)
# Not same as os.environ or os.environb

View File

@@ -1,16 +1,10 @@
_?curses.color_pair
(os|posix).EFD_CLOEXEC
(os|posix).EFD_NONBLOCK
(os|posix).EFD_SEMAPHORE
(os|posix).SPLICE_F_MORE
(os|posix).SPLICE_F_MOVE
(os|posix).SPLICE_F_NONBLOCK
(os|posix).setresgid
(os|posix).setresuid
(os|posix).sendfile
(os|posix).eventfd
(os|posix).eventfd_read
(os|posix).eventfd_write
(os|posix).splice
signal.sigtimedwait
signal.sigwaitinfo

View File

@@ -1,17 +1,11 @@
_?curses.color_pair
mmap.MAP_STACK
(os|posix).EFD_CLOEXEC
(os|posix).EFD_NONBLOCK
(os|posix).EFD_SEMAPHORE
(os|posix).SPLICE_F_MORE
(os|posix).SPLICE_F_MOVE
(os|posix).SPLICE_F_NONBLOCK
(os|posix).setresgid
(os|posix).setresuid
(os|posix).sendfile
(os|posix).eventfd
(os|posix).eventfd_read
(os|posix).eventfd_write
(os|posix).splice
signal.sigtimedwait
signal.sigwaitinfo

View File

@@ -1,11 +1,5 @@
_?curses.color_pair
_posixsubprocess.fork_exec
(os|posix).EFD_CLOEXEC
(os|posix).EFD_NONBLOCK
(os|posix).EFD_SEMAPHORE
(os|posix).eventfd
(os|posix).eventfd_read
(os|posix).eventfd_write
(os|posix).sendfile
(os|posix).setns
(os|posix).setresgid
@@ -14,7 +8,6 @@ _posixsubprocess.fork_exec
(os|posix).SPLICE_F_MORE
(os|posix).SPLICE_F_MOVE
(os|posix).SPLICE_F_NONBLOCK
(os|posix).unshare
fcntl.FICLONE
fcntl.FICLONERANGE
mmap.MAP_STACK