Skip to content

Commit

Permalink
Add fchmod and lchmod for Windows on 3.13 (#12662)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-muoto authored Sep 15, 2024
1 parent 9e506eb commit dbe4d32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 0 additions & 4 deletions stdlib/@tests/stubtest_allowlists/win32-py313.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# New in py313 (triage these!)
nt.fchmod
nt.lchmod
ntpath.exists
ntpath.lexists
ntpath.splitroot
os.fchmod
os.lchmod
os.path.exists
os.path.lexists

Expand Down
2 changes: 2 additions & 0 deletions stdlib/nt.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,7 @@ if sys.platform == "win32":
listvolumes as listvolumes,
set_blocking as set_blocking,
)
if sys.version_info >= (3, 13):
from os import fchmod as fchmod, lchmod as lchmod

environ: dict[str, str]
11 changes: 9 additions & 2 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ if sys.version_info >= (3, 12) or sys.platform != "win32":
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: ...
Expand Down Expand Up @@ -754,7 +753,6 @@ def chmod(path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, f
if sys.platform != "win32" and sys.platform != "linux":
def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = True) -> None: ... # some flavors of Unix
def lchflags(path: StrOrBytesPath, flags: int) -> None: ...
def lchmod(path: StrOrBytesPath, mode: int) -> None: ...

if sys.platform != "win32":
def chroot(path: StrOrBytesPath) -> None: ...
Expand Down Expand Up @@ -1179,3 +1177,12 @@ if sys.version_info >= (3, 13) and sys.platform == "linux":
def timerfd_settime_ns(fd: FileDescriptor, /, *, flags: int = 0, initial: int = 0, interval: int = 0) -> tuple[int, int]: ...
def timerfd_gettime(fd: FileDescriptor, /) -> tuple[float, float]: ...
def timerfd_gettime_ns(fd: FileDescriptor, /) -> tuple[int, int]: ...

if sys.version_info >= (3, 13) or sys.platform != "win32":
# Added to Windows in 3.13.
def fchmod(fd: int, mode: int) -> None: ...

if sys.platform != "linux":
if sys.version_info >= (3, 13) or sys.platform != "win32":
# Added to Windows in 3.13.
def lchmod(path: StrOrBytesPath, mode: int) -> None: ...

0 comments on commit dbe4d32

Please sign in to comment.