Skip to content

Commit

Permalink
Update os on Windows, Python3.12+ (#10749)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Waygood <[email protected]>
  • Loading branch information
aminalaee and AlexWaygood authored Sep 22, 2023
1 parent 6dfa285 commit 96eaa76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
20 changes: 16 additions & 4 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
if sys.version_info >= (3, 8):
@property
def st_reparse_tag(self) -> int: ...
if sys.version_info >= (3, 12):
@property
def st_birthtime(self) -> float: ... # time of file creation in seconds
@property
def st_birthtime_ns(self) -> int: ... # time of file creation in nanoseconds
else:
@property
def st_blocks(self) -> int: ... # number of blocks allocated for file
Expand All @@ -349,13 +354,13 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
@property
def st_rdev(self) -> int: ... # type of device if an inode device
if sys.platform != "linux":
# These properties are available on MacOS, but not on Windows or Ubuntu.
# These properties are available on MacOS, but not Ubuntu.
# On other Unix systems (such as FreeBSD), the following attributes may be
# available (but may be only filled out if root tries to use them):
@property
def st_gen(self) -> int: ... # file generation number
@property
def st_birthtime(self) -> int: ... # time of file creation
def st_birthtime(self) -> float: ... # time of file creation in seconds
if sys.platform == "darwin":
@property
def st_flags(self) -> int: ... # user defined flags for file
Expand Down Expand Up @@ -616,13 +621,15 @@ def open(path: StrOrBytesPath, flags: int, mode: int = 0o777, *, dir_fd: int | N
def pipe() -> tuple[int, int]: ...
def read(__fd: int, __length: int) -> bytes: ...

if sys.version_info >= (3, 12) or sys.platform != "win32":
def get_blocking(__fd: int) -> bool: ...
def set_blocking(__fd: int, __blocking: bool) -> None: ...

if sys.platform != "win32":
def fchmod(fd: int, mode: int) -> None: ...
def fchown(fd: int, uid: int, gid: int) -> None: ...
def fpathconf(__fd: int, __name: str | int) -> int: ...
def fstatvfs(__fd: int) -> statvfs_result: ...
def get_blocking(__fd: int) -> bool: ...
def set_blocking(__fd: int, __blocking: bool) -> None: ...
def lockf(__fd: int, __command: int, __length: int) -> None: ...
def openpty() -> tuple[int, int]: ... # some flavors of Unix
if sys.platform != "darwin":
Expand Down Expand Up @@ -1044,3 +1051,8 @@ if sys.version_info >= (3, 9):

if sys.platform == "linux":
def pidfd_open(pid: int, flags: int = ...) -> int: ...

if sys.version_info >= (3, 12) and sys.platform == "win32":
def listdrives() -> list[str]: ...
def listmounts(volume: str) -> list[str]: ...
def listvolumes() -> list[str]: ...
7 changes: 0 additions & 7 deletions tests/stubtest_allowlists/win32-py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,4 @@ asyncio.windows_events.IocpProactor.finish_socket_func
asyncio.windows_events.IocpProactor.recvfrom_into
msvcrt.GetErrorMode
ntpath.isdir
os.get_blocking
os.listdrives
os.listmounts
os.listvolumes
os.path.isdir
os.set_blocking
os.stat_result.st_birthtime
os.stat_result.st_birthtime_ns

0 comments on commit 96eaa76

Please sign in to comment.