Skip to content

Commit 96eaa76

Browse files
Update os on Windows, Python3.12+ (#10749)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 6dfa285 commit 96eaa76

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

stdlib/os/__init__.pyi

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,11 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
341341
if sys.version_info >= (3, 8):
342342
@property
343343
def st_reparse_tag(self) -> int: ...
344+
if sys.version_info >= (3, 12):
345+
@property
346+
def st_birthtime(self) -> float: ... # time of file creation in seconds
347+
@property
348+
def st_birthtime_ns(self) -> int: ... # time of file creation in nanoseconds
344349
else:
345350
@property
346351
def st_blocks(self) -> int: ... # number of blocks allocated for file
@@ -349,13 +354,13 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
349354
@property
350355
def st_rdev(self) -> int: ... # type of device if an inode device
351356
if sys.platform != "linux":
352-
# These properties are available on MacOS, but not on Windows or Ubuntu.
357+
# These properties are available on MacOS, but not Ubuntu.
353358
# On other Unix systems (such as FreeBSD), the following attributes may be
354359
# available (but may be only filled out if root tries to use them):
355360
@property
356361
def st_gen(self) -> int: ... # file generation number
357362
@property
358-
def st_birthtime(self) -> int: ... # time of file creation
363+
def st_birthtime(self) -> float: ... # time of file creation in seconds
359364
if sys.platform == "darwin":
360365
@property
361366
def st_flags(self) -> int: ... # user defined flags for file
@@ -616,13 +621,15 @@ def open(path: StrOrBytesPath, flags: int, mode: int = 0o777, *, dir_fd: int | N
616621
def pipe() -> tuple[int, int]: ...
617622
def read(__fd: int, __length: int) -> bytes: ...
618623

624+
if sys.version_info >= (3, 12) or sys.platform != "win32":
625+
def get_blocking(__fd: int) -> bool: ...
626+
def set_blocking(__fd: int, __blocking: bool) -> None: ...
627+
619628
if sys.platform != "win32":
620629
def fchmod(fd: int, mode: int) -> None: ...
621630
def fchown(fd: int, uid: int, gid: int) -> None: ...
622631
def fpathconf(__fd: int, __name: str | int) -> int: ...
623632
def fstatvfs(__fd: int) -> statvfs_result: ...
624-
def get_blocking(__fd: int) -> bool: ...
625-
def set_blocking(__fd: int, __blocking: bool) -> None: ...
626633
def lockf(__fd: int, __command: int, __length: int) -> None: ...
627634
def openpty() -> tuple[int, int]: ... # some flavors of Unix
628635
if sys.platform != "darwin":
@@ -1044,3 +1051,8 @@ if sys.version_info >= (3, 9):
10441051

10451052
if sys.platform == "linux":
10461053
def pidfd_open(pid: int, flags: int = ...) -> int: ...
1054+
1055+
if sys.version_info >= (3, 12) and sys.platform == "win32":
1056+
def listdrives() -> list[str]: ...
1057+
def listmounts(volume: str) -> list[str]: ...
1058+
def listvolumes() -> list[str]: ...

tests/stubtest_allowlists/win32-py312.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,4 @@ asyncio.windows_events.IocpProactor.finish_socket_func
55
asyncio.windows_events.IocpProactor.recvfrom_into
66
msvcrt.GetErrorMode
77
ntpath.isdir
8-
os.get_blocking
9-
os.listdrives
10-
os.listmounts
11-
os.listvolumes
128
os.path.isdir
13-
os.set_blocking
14-
os.stat_result.st_birthtime
15-
os.stat_result.st_birthtime_ns

0 commit comments

Comments
 (0)