Skip to content

Use octal for mode defaults #9670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/dbm/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ class _error(Exception): ...
error: tuple[type[_error], type[OSError]]

def whichdb(filename: str) -> str: ...
def open(file: str, flag: _TFlags = "r", mode: int = 438) -> _Database: ...
def open(file: str, flag: _TFlags = "r", mode: int = 0o666) -> _Database: ...
2 changes: 1 addition & 1 deletion stdlib/dbm/dumb.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class _Database(MutableMapping[_KeyType, bytes]):
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...

def open(file: str, flag: str = "c", mode: int = 438) -> _Database: ...
def open(file: str, flag: str = "c", mode: int = 0o666) -> _Database: ...
2 changes: 1 addition & 1 deletion stdlib/dbm/gnu.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ if sys.platform != "win32":
# Don't exist at runtime
__new__: None # type: ignore[assignment]
__init__: None # type: ignore[assignment]
def open(__filename: str, __flags: str = "r", __mode: int = 438) -> _gdbm: ...
def open(__filename: str, __flags: str = "r", __mode: int = 0o666) -> _gdbm: ...
2 changes: 1 addition & 1 deletion stdlib/dbm/ndbm.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ if sys.platform != "win32":
# Don't exist at runtime
__new__: None # type: ignore[assignment]
__init__: None # type: ignore[assignment]
def open(__filename: str, __flags: str = "r", __mode: int = 438) -> _dbm: ...
def open(__filename: str, __flags: str = "r", __mode: int = 0o666) -> _dbm: ...
2 changes: 1 addition & 1 deletion stdlib/distutils/ccompiler.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class CCompiler:
def shared_object_filename(self, basename: str, strip_dir: int = 0, output_dir: str = "") -> str: ...
def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = None, level: int = 1) -> None: ...
def spawn(self, cmd: list[str]) -> None: ...
def mkpath(self, name: str, mode: int = 511) -> None: ...
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
def move_file(self, src: str, dst: str) -> str: ...
def announce(self, msg: str, level: int = 1) -> None: ...
def warn(self, msg: str) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/distutils/cmd.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Command:
def get_sub_commands(self) -> list[str]: ...
def warn(self, msg: str) -> None: ...
def execute(self, func: Callable[..., object], args: Iterable[Any], msg: str | None = None, level: int = 1) -> None: ...
def mkpath(self, name: str, mode: int = 511) -> None: ...
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
def copy_file(
self, infile: str, outfile: str, preserve_mode: int = 1, preserve_times: int = 1, link: str | None = None, level: Any = 1
) -> tuple[str, bool]: ... # level is not used
Expand Down
4 changes: 2 additions & 2 deletions stdlib/distutils/dir_util.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def mkpath(name: str, mode: int = 511, verbose: int = 1, dry_run: int = 0) -> list[str]: ...
def create_tree(base_dir: str, files: list[str], mode: int = 511, verbose: int = 1, dry_run: int = 0) -> None: ...
def mkpath(name: str, mode: int = 0o777, verbose: int = 1, dry_run: int = 0) -> list[str]: ...
def create_tree(base_dir: str, files: list[str], mode: int = 0o777, verbose: int = 1, dry_run: int = 0) -> None: ...
def copy_tree(
src: str,
dst: str,
Expand Down
2 changes: 1 addition & 1 deletion stdlib/importlib/machinery.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class FileFinder(importlib.abc.PathEntryFinder):
) -> Callable[[str], importlib.abc.PathEntryFinder]: ...

class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader):
def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = 438) -> None: ...
def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = 0o666) -> None: ...

class SourcelessFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ...

Expand Down
10 changes: 5 additions & 5 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ if sys.platform != "win32" and sys.version_info >= (3, 11):
def login_tty(__fd: int) -> None: ...

def lseek(__fd: int, __position: int, __how: int) -> int: ...
def open(path: StrOrBytesPath, flags: int, mode: int = 511, *, dir_fd: int | None = None) -> int: ...
def open(path: StrOrBytesPath, flags: int, mode: int = 0o777, *, dir_fd: int | None = None) -> int: ...
def pipe() -> tuple[int, int]: ...
def read(__fd: int, __length: int) -> bytes: ...

Expand Down Expand Up @@ -707,15 +707,15 @@ def link(
follow_symlinks: bool = True,
) -> None: ...
def lstat(path: StrOrBytesPath, *, dir_fd: int | None = None) -> stat_result: ...
def mkdir(path: StrOrBytesPath, mode: int = 511, *, dir_fd: int | None = None) -> None: ...
def mkdir(path: StrOrBytesPath, mode: int = 0o777, *, dir_fd: int | None = None) -> None: ...

if sys.platform != "win32":
def mkfifo(path: StrOrBytesPath, mode: int = 438, *, dir_fd: int | None = None) -> None: ... # Unix only
def mkfifo(path: StrOrBytesPath, mode: int = 0o666, *, dir_fd: int | None = None) -> None: ... # Unix only

def makedirs(name: StrOrBytesPath, mode: int = 511, exist_ok: bool = False) -> None: ...
def makedirs(name: StrOrBytesPath, mode: int = 0o777, exist_ok: bool = False) -> None: ...

if sys.platform != "win32":
def mknod(path: StrOrBytesPath, mode: int = 384, device: int = 0, *, dir_fd: int | None = None) -> None: ...
def mknod(path: StrOrBytesPath, mode: int = 0o600, device: int = 0, *, dir_fd: int | None = None) -> None: ...
def major(__device: int) -> int: ...
def minor(__device: int) -> int: ...
def makedev(__major: int, __minor: int) -> int: ...
Expand Down
4 changes: 2 additions & 2 deletions stdlib/pathlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Path(PurePath):
def iterdir(self: Self) -> Generator[Self, None, None]: ...
def lchmod(self, mode: int) -> None: ...
def lstat(self) -> stat_result: ...
def mkdir(self, mode: int = 511, parents: bool = False, exist_ok: bool = False) -> None: ...
def mkdir(self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False) -> None: ...
# Adapted from builtins.open
# Text mode: always returns a TextIOWrapper
# The Traversable .open in stdlib/importlib/abc.pyi should be kept in sync with this.
Expand Down Expand Up @@ -178,7 +178,7 @@ class Path(PurePath):
if sys.version_info >= (3, 10):
def hardlink_to(self, target: str | Path) -> None: ...

def touch(self, mode: int = 438, exist_ok: bool = True) -> None: ...
def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None: ...
if sys.version_info >= (3, 8):
def unlink(self, missing_ok: bool = False) -> None: ...
else:
Expand Down
2 changes: 1 addition & 1 deletion stdlib/zipfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ZipFile:
compresslevel: int | None = None,
) -> None: ...
if sys.version_info >= (3, 11):
def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = 511) -> None: ...
def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = 0o777) -> None: ...

class PyZipFile(ZipFile):
def __init__(
Expand Down