Fix availability of some constants for Windows (#10818)

This commit is contained in:
Alex Waygood
2023-10-02 00:27:55 +01:00
committed by GitHub
parent efa7a51d09
commit 205cfcfca6
5 changed files with 8 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ if sys.platform != "win32":
PROT_READ: int
PROT_WRITE: int
PAGESIZE: int
PAGESIZE: int
class mmap(Iterable[int], Sized):
if sys.platform == "win32":

View File

@@ -1,8 +1,9 @@
import sys
from typing_extensions import Literal
from typing_extensions import Final, Literal
# This module is only available on Windows
if sys.platform == "win32":
CRT_ASSEMBLY_VERSION: Final[str]
LK_UNLCK: Literal[0]
LK_LOCK: Literal[1]
LK_NBLCK: Literal[2]

View File

@@ -10,10 +10,8 @@ NSIG: int
class Signals(IntEnum):
SIGABRT: int
SIGEMT: int
SIGFPE: int
SIGILL: int
SIGINFO: int
SIGINT: int
SIGSEGV: int
SIGTERM: int
@@ -23,6 +21,8 @@ class Signals(IntEnum):
CTRL_C_EVENT: int
CTRL_BREAK_EVENT: int
else:
SIGEMT: int
SIGINFO: int
SIGALRM: int
SIGBUS: int
SIGCHLD: int
@@ -77,10 +77,8 @@ else:
def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ...
SIGABRT: Signals
SIGEMT: Signals
SIGFPE: Signals
SIGILL: Signals
SIGINFO: Signals
SIGINT: Signals
SIGSEGV: Signals
SIGTERM: Signals
@@ -90,6 +88,8 @@ if sys.platform == "win32":
CTRL_C_EVENT: Signals
CTRL_BREAK_EVENT: Signals
else:
SIGINFO: Signals
SIGEMT: Signals
SIGALRM: Signals
SIGBUS: Signals
SIGCHLD: Signals

View File

@@ -4,6 +4,7 @@ from typing import overload
from typing_extensions import Literal
if sys.platform == "win32":
SND_APPLICATION: Literal[128]
SND_FILENAME: Literal[131072]
SND_ALIAS: Literal[65536]
SND_LOOP: Literal[8]

View File

@@ -1,16 +1,11 @@
ctypes.GetLastError # Is actually a pointer
locale.[A-Z0-9_]+ # Constants that should be moved to _locale and re-exported conditionally
locale.nl_langinfo # Function that should be moved to _locale and re-exported conditionally
mmap.PAGESIZE
# alias for a class defined elsewhere,
# mypy infers the variable has type `(*args) -> DupHandle` but stubtest infers the runtime type as <class DupHandle>
multiprocessing.reduction.AbstractReducer.DupHandle
msilib.text.dirname
msvcrt.CRT_ASSEMBLY_VERSION
selectors.KqueueSelector
signal.SIGEMT
signal.SIGINFO
winsound.SND_APPLICATION
# Exists at runtime, but missing from stubs
_msi.MSIError