Fix platform availability of some Unix constants (#10857)

This commit is contained in:
Alex Waygood
2023-10-08 00:05:20 +02:00
committed by GitHub
parent 8acf1944f3
commit e4edcf23e0
6 changed files with 22 additions and 20 deletions

View File

@@ -61,7 +61,8 @@ if sys.platform != "win32":
A_DIM: int
A_HORIZONTAL: int
A_INVIS: int
A_ITALIC: int
if sys.platform != "darwin":
A_ITALIC: int
A_LEFT: int
A_LOW: int
A_NORMAL: int

View File

@@ -70,9 +70,20 @@ if sys.platform != "win32":
POSIX_FADV_WILLNEED: int
POSIX_FADV_DONTNEED: int
SF_NODISKIO: int
SF_MNOWAIT: int
SF_SYNC: int
if sys.platform != "linux" and sys.platform != "darwin":
# In the os-module docs, these are marked as being available
# on "Unix, not Emscripten, not WASI."
# However, in the source code, a comment indicates they're "FreeBSD constants".
# sys.platform could have one of many values on a FreeBSD Python build,
# so the sys-module docs recommend doing `if sys.platform.startswith('freebsd')`
# to detect FreeBSD builds. Unfortunately that would be too dynamic
# for type checkers, however.
SF_NODISKIO: int
SF_MNOWAIT: int
SF_SYNC: int
if sys.version_info >= (3, 11):
SF_NOCACHE: int
if sys.platform == "linux":
XATTR_SIZE_MAX: int

View File

@@ -137,7 +137,6 @@ if sys.platform == "linux":
EPOLLRDNORM: int
EPOLLWRBAND: int
EPOLLWRNORM: int
EPOLL_RDHUP: int
EPOLL_CLOEXEC: int
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":

View File

@@ -21,8 +21,6 @@ class Signals(IntEnum):
CTRL_C_EVENT: int
CTRL_BREAK_EVENT: int
else:
SIGEMT: int
SIGINFO: int
SIGALRM: int
SIGBUS: int
SIGCHLD: int
@@ -47,6 +45,9 @@ class Signals(IntEnum):
SIGWINCH: int
SIGXCPU: int
SIGXFSZ: int
if sys.platform != "linux":
SIGEMT: int
SIGINFO: int
if sys.platform != "darwin":
SIGCLD: int
SIGPOLL: int
@@ -88,8 +89,9 @@ if sys.platform == "win32":
CTRL_C_EVENT: Signals
CTRL_BREAK_EVENT: Signals
else:
SIGINFO: Signals
SIGEMT: Signals
if sys.platform != "linux":
SIGINFO: Signals
SIGEMT: Signals
SIGALRM: Signals
SIGBUS: Signals
SIGCHLD: Signals