Add timer notification functions for os/posix, 3.13 (#12378)

This commit is contained in:
Max Muoto
2024-07-20 15:39:10 -05:00
committed by GitHub
parent 240e3d8004
commit f54427b660
3 changed files with 27 additions and 18 deletions

View File

@@ -19,26 +19,8 @@ fcntl.RWH_WRITE_LIFE_NOT_SET
fcntl.RWH_WRITE_LIFE_SHORT
mmap.MAP_NORESERVE
os.POSIX_SPAWN_CLOSEFROM
os.TFD_CLOEXEC
os.TFD_NONBLOCK
os.TFD_TIMER_ABSTIME
os.TFD_TIMER_CANCEL_ON_SET
os.timerfd_create
os.timerfd_gettime
os.timerfd_gettime_ns
os.timerfd_settime
os.timerfd_settime_ns
posix.POSIX_SPAWN_CLOSEFROM
posix.TFD_CLOEXEC
posix.TFD_NONBLOCK
posix.TFD_TIMER_ABSTIME
posix.TFD_TIMER_CANCEL_ON_SET
posixpath.splitroot
posix.timerfd_create
posix.timerfd_gettime
posix.timerfd_gettime_ns
posix.timerfd_settime
posix.timerfd_settime_ns
readline.backend
stat.SF_SUPPORTED
stat.SF_SYNTHETIC

View File

@@ -1162,3 +1162,17 @@ if sys.version_info >= (3, 13) and sys.platform != "win32":
def grantpt(fd: FileDescriptorLike, /) -> None: ...
def unlockpt(fd: FileDescriptorLike, /) -> None: ...
def ptsname(fd: FileDescriptorLike, /) -> str: ...
if sys.version_info >= (3, 13) and sys.platform == "linux":
TFD_TIMER_ABSTIME: Final = 1
TFD_TIMER_CANCEL_ON_SET: Final = 2
TFD_NONBLOCK: Final[int]
TFD_CLOEXEC: Final[int]
def timerfd_create(clockid: int, /, *, flags: int = 0) -> int: ...
def timerfd_settime(
fd: FileDescriptor, /, *, flags: int = 0, initial: float = 0.0, interval: float = 0.0
) -> tuple[float, float]: ...
def timerfd_settime_ns(fd: FileDescriptor, /, *, flags: int = 0, initial: int = 0, interval: int = 0) -> tuple[int, int]: ...
def timerfd_gettime(fd: FileDescriptor, /) -> tuple[float, float]: ...
def timerfd_gettime_ns(fd: FileDescriptor, /) -> tuple[int, int]: ...

View File

@@ -239,6 +239,19 @@ if sys.platform != "win32":
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.version_info >= (3, 13) and sys.platform == "linux":
from os import (
TFD_CLOEXEC as TFD_CLOEXEC,
TFD_NONBLOCK as TFD_NONBLOCK,
TFD_TIMER_ABSTIME as TFD_TIMER_ABSTIME,
TFD_TIMER_CANCEL_ON_SET as TFD_TIMER_CANCEL_ON_SET,
timerfd_create as timerfd_create,
timerfd_gettime as timerfd_gettime,
timerfd_gettime_ns as timerfd_gettime_ns,
timerfd_settime as timerfd_settime,
timerfd_settime_ns as timerfd_settime_ns,
)
if sys.platform != "linux":
from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod