Make various os functions available on Windows (#6500)

This commit is contained in:
Alex Waygood
2021-12-05 20:06:22 +00:00
committed by GitHub
parent 28803c4c4a
commit 415d387009
7 changed files with 13 additions and 34 deletions

View File

@@ -416,6 +416,13 @@ def getpid() -> int: ...
def getppid() -> int: ...
def strerror(__code: int) -> str: ...
def umask(__mask: int) -> int: ...
@final
class uname_result(NamedTuple):
sysname: str
nodename: str
release: str
version: str
machine: str
if sys.platform != "win32":
def ctermid() -> str: ...
@@ -447,13 +454,6 @@ if sys.platform != "win32":
def getsid(__pid: int) -> int: ...
def setsid() -> None: ...
def setuid(__uid: int) -> None: ...
@final
class uname_result(NamedTuple):
sysname: str
nodename: str
release: str
version: str
machine: str
def uname() -> uname_result: ...
@overload
@@ -469,7 +469,7 @@ if sys.platform != "win32":
def putenv(__name: bytes | str, __value: bytes | str) -> None: ...
if sys.platform != "win32":
if sys.platform != "win32" or sys.version_info >= (3, 9):
def unsetenv(__name: bytes | str) -> None: ...
_Opener = Callable[[str, int], int]
@@ -563,7 +563,9 @@ else:
def dup2(fd: int, fd2: int, inheritable: bool = ...) -> None: ...
def fstat(fd: int) -> stat_result: ...
def ftruncate(__fd: int, __length: int) -> None: ...
def fsync(fd: FileDescriptorLike) -> None: ...
def isatty(__fd: int) -> bool: ...
def lseek(__fd: int, __position: int, __how: int) -> int: ...
def open(path: StrOrBytesPath, flags: int, mode: int = ..., *, dir_fd: int | None = ...) -> int: ...
def pipe() -> tuple[int, int]: ...
@@ -577,10 +579,8 @@ if sys.platform != "win32":
def fdatasync(fd: FileDescriptorLike) -> None: ... # Unix only, not Mac
def fpathconf(__fd: int, __name: str | int) -> int: ...
def fstatvfs(__fd: int) -> statvfs_result: ...
def ftruncate(__fd: int, __length: int) -> None: ...
def get_blocking(__fd: int) -> bool: ...
def set_blocking(__fd: int, __blocking: bool) -> None: ...
def isatty(__fd: int) -> bool: ...
def lockf(__fd: int, __command: int, __length: int) -> None: ...
def openpty() -> tuple[int, int]: ... # some flavors of Unix
if sys.platform != "darwin":

View File

@@ -57,9 +57,6 @@ grp.struct_group.n_unnamed_fields
mimetypes.MimeTypes.read_windows_registry
os.ST_NOSUID
os.ST_RDONLY
(os|posix).uname_result.n_fields
(os|posix).uname_result.n_sequence_fields
(os|posix).uname_result.n_unnamed_fields
posix.chflags
posix.dup2
posix.lchflags

View File

@@ -62,9 +62,6 @@ mimetypes.MimeTypes.read_windows_registry
(os|posix).sched_param.n_fields
(os|posix).sched_param.n_sequence_fields
(os|posix).sched_param.n_unnamed_fields
(os|posix).uname_result.n_fields
(os|posix).uname_result.n_sequence_fields
(os|posix).uname_result.n_unnamed_fields
(os|posix).waitid_result.n_fields
(os|posix).waitid_result.n_sequence_fields
(os|posix).waitid_result.n_unnamed_fields

View File

@@ -581,6 +581,9 @@ multiprocessing.synchronize.Semaphore.get_value
(os|posix).times_result.n_fields
(os|posix).times_result.n_sequence_fields
(os|posix).times_result.n_unnamed_fields
(os|posix).uname_result.n_fields
(os|posix).uname_result.n_sequence_fields
(os|posix).uname_result.n_unnamed_fields
pickle.Pickler.memo
pickle.Unpickler.memo
pipes.Template.makepipeline

View File

@@ -16,6 +16,5 @@ asyncio.IocpProactor.sendto
asyncio.windows_events.IocpProactor.recvfrom
asyncio.windows_events.IocpProactor.sendto
msvcrt.GetErrorMode
os.unsetenv
socket.MsgFlag.MSG_ERRQUEUE
subprocess.STARTUPINFO.copy

View File

@@ -1,17 +1,4 @@
# Missing from stubs, found by removing --ignore-missing-stub
_winapi.CreateFileMapping
_winapi.MapViewOfFile
_winapi.OpenFileMapping
_winapi.VirtualQuerySize
asyncio.IocpProactor.recvfrom
asyncio.IocpProactor.sendto
asyncio.windows_events.IocpProactor.recvfrom
asyncio.windows_events.IocpProactor.sendto
os.unsetenv
socket.MsgFlag.MSG_ERRQUEUE
subprocess.STARTUPINFO.copy
# Exists at runtime, but missing from stubs
_winapi.CreateFileMapping
_winapi.MapViewOfFile
@@ -21,6 +8,5 @@ asyncio.IocpProactor.recvfrom
asyncio.IocpProactor.sendto
asyncio.windows_events.IocpProactor.recvfrom
asyncio.windows_events.IocpProactor.sendto
os.unsetenv
socket.MsgFlag.MSG_ERRQUEUE
subprocess.STARTUPINFO.copy

View File

@@ -46,12 +46,9 @@ distutils.msvccompiler.MSVCCompiler.manifest_get_embed_info
distutils.msvccompiler.MSVCCompiler.manifest_setup_ldargs
distutils.msvccompiler.OldMSVCCompiler
msvcrt.SetErrorMode
os.ftruncate
os.get_handle_inheritable
os.isatty
os.set_handle_inheritable
os.statvfs_result
os.uname_result
signal.Signals.CTRL_BREAK_EVENT
signal.Signals.CTRL_C_EVENT
socket.MsgFlag.MSG_BCAST