Skip to content

Commit 0ffff97

Browse files
authored
Fix 3.15 stdlib stubtest (#15863)
1 parent a8e75dc commit 0ffff97

7 files changed

Lines changed: 42 additions & 29 deletions

File tree

stdlib/builtins.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ if sys.version_info >= (3, 15):
21852185
class sentinel:
21862186
__name__: str
21872187
__module__: str
2188-
def __new__(cls, name: str, /) -> Self: ...
2188+
def __new__(cls, name: str, /, *, repr: str | None = None) -> Self: ...
21892189
def __copy__(self, /) -> Self: ...
21902190
def __deepcopy__(self, memo: Any, /) -> Self: ...
21912191
def __or__(self, other: Any, /) -> Any: ...

stdlib/os/__init__.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,11 @@ def mkdir(path: StrOrBytesPath, mode: int = 0o777, *, dir_fd: int | None = None)
13051305
if sys.platform != "win32":
13061306
def mkfifo(path: StrOrBytesPath, mode: int = 0o666, *, dir_fd: int | None = None) -> None: ... # Unix only
13071307

1308-
def makedirs(name: StrOrBytesPath, mode: int = 0o777, exist_ok: bool = False) -> None: ...
1308+
if sys.version_info >= (3, 15):
1309+
def makedirs(name: StrOrBytesPath, mode: int = 0o777, exist_ok: bool = False, *, parent_mode: int | None = None) -> None: ...
1310+
1311+
else:
1312+
def makedirs(name: StrOrBytesPath, mode: int = 0o777, exist_ok: bool = False) -> None: ...
13091313

13101314
if sys.platform != "win32":
13111315
def mknod(path: StrOrBytesPath, mode: int = 0o600, device: int = 0, *, dir_fd: int | None = None) -> None: ...

stdlib/pathlib/__init__.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,12 @@ class Path(PurePath):
208208
def iterdir(self) -> Generator[Self]: ...
209209
def lchmod(self, mode: int) -> None: ...
210210
def lstat(self) -> stat_result: ...
211-
def mkdir(self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False) -> None: ...
211+
if sys.version_info >= (3, 15):
212+
def mkdir(
213+
self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False, *, parent_mode: int | None = None
214+
) -> None: ...
215+
else:
216+
def mkdir(self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False) -> None: ...
212217

213218
if sys.version_info >= (3, 14):
214219
@property

stdlib/pprint.pyi

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ from typing import IO
66
__all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter", "pp"]
77

88
if sys.version_info >= (3, 15):
9+
# The `expand` parameter was added in Python 3.15.
910
def pformat(
1011
object: object,
11-
indent: int = 4,
12-
width: int = 88,
12+
indent: int = 1,
13+
width: int = 80,
1314
depth: int | None = None,
1415
*,
1516
compact: bool = False,
17+
expand: bool = False,
1618
sort_dicts: bool = True,
1719
underscore_numbers: bool = False,
1820
) -> str: ...
@@ -30,14 +32,16 @@ else:
3032
) -> str: ...
3133

3234
if sys.version_info >= (3, 15):
35+
# The `expand` parameter was added in Python 3.15.
3336
def pp(
3437
object: object,
3538
stream: IO[str] | None = None,
36-
indent: int = 4,
37-
width: int = 88,
39+
indent: int = 1,
40+
width: int = 80,
3841
depth: int | None = None,
3942
*,
4043
compact: bool = False,
44+
expand: bool = False,
4145
sort_dicts: bool = False,
4246
underscore_numbers: bool = False,
4347
) -> None: ...
@@ -56,14 +60,16 @@ else:
5660
) -> None: ...
5761

5862
if sys.version_info >= (3, 15):
63+
# The `expand` parameter was added in Python 3.15.
5964
def pprint(
6065
object: object,
6166
stream: IO[str] | None = None,
62-
indent: int = 4,
63-
width: int = 88,
67+
indent: int = 1,
68+
width: int = 80,
6469
depth: int | None = None,
6570
*,
6671
compact: bool = False,
72+
expand: bool = False,
6773
sort_dicts: bool = True,
6874
underscore_numbers: bool = False,
6975
) -> None: ...
@@ -87,14 +93,16 @@ def saferepr(object: object) -> str: ...
8793

8894
class PrettyPrinter:
8995
if sys.version_info >= (3, 15):
96+
# The `expand` parameter was added in Python 3.15.
9097
def __init__(
9198
self,
92-
indent: int = 4,
93-
width: int = 88,
99+
indent: int = 1,
100+
width: int = 80,
94101
depth: int | None = None,
95102
stream: IO[str] | None = None,
96103
*,
97104
compact: bool = False,
105+
expand: bool = False,
98106
sort_dicts: bool = True,
99107
underscore_numbers: bool = False,
100108
) -> None: ...

stdlib/profiling/sampling/collector.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import StrOrBytesPath
22
from abc import ABC, abstractmethod
33
from collections.abc import Sequence
4-
from typing import TypeAlias
4+
from typing import ClassVar, TypeAlias
55

66
from _remote_debugging import AwaitedInfo, FrameInfo, InterpreterInfo, LocationInfo
77

@@ -15,6 +15,7 @@ def filter_internal_frames(frames: Sequence[_Frame]) -> list[_Frame]: ...
1515
def iter_async_frames(awaited_info_list: Sequence[AwaitedInfo]) -> object: ...
1616

1717
class Collector(ABC):
18+
aggregating: ClassVar[bool] # undocumented
1819
@abstractmethod
1920
def collect(
2021
self, stack_frames: Sequence[InterpreterInfo] | Sequence[AwaitedInfo], timestamps_us: _Timestamps = None

stdlib/site.pyi

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,17 @@ def abs_paths() -> None: ... # undocumented
1212
def addpackage(sitedir: StrPath, name: StrPath, known_paths: set[str] | None) -> set[str] | None: ... # undocumented
1313

1414
if sys.version_info >= (3, 15):
15-
def process_startup_files() -> None: ... # undocumented
16-
def addsitedir(sitedir: str, known_paths: set[str] | None = None, *, defer_processing_start_files: bool = False) -> None: ...
17-
def addsitepackages(
18-
known_paths: set[str] | None, prefixes: Iterable[str] | None = None, *, defer_processing_start_files: bool = False
19-
) -> set[str] | None: ... # undocumented
20-
def addusersitepackages(
21-
known_paths: set[str] | None, *, defer_processing_start_files: bool = False
22-
) -> set[str] | None: ... # undocumented
23-
24-
else:
25-
def addsitedir(sitedir: str, known_paths: set[str] | None = None) -> None: ...
26-
def addsitepackages(
27-
known_paths: set[str] | None, prefixes: Iterable[str] | None = None
28-
) -> set[str] | None: ... # undocumented
29-
def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented
30-
15+
class StartupState:
16+
__slots__ = ("_known_paths", "_processed_sitedirs", "_path_entries", "_importexecs", "_entrypoints")
17+
def __init__(self, known_paths: set[str] | None = None) -> None: ...
18+
def addsitedir(self, sitedir: str) -> None: ...
19+
def addusersitepackages(self) -> None: ...
20+
def addsitepackages(self, prefixes: Iterable[str] | None = None) -> None: ...
21+
def process(self) -> None: ...
22+
23+
def addsitedir(sitedir: str, known_paths: set[str] | None = None) -> None: ...
24+
def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = None) -> set[str] | None: ... # undocumented
25+
def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented
3126
def check_enableusersite() -> bool | None: ... # undocumented
3227

3328
if sys.version_info >= (3, 13):

stdlib/sys/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ maxunicode: int
5353
meta_path: list[MetaPathFinderProtocol]
5454
modules: dict[str, ModuleType]
5555
if sys.version_info >= (3, 15):
56-
lazy_modules: dict[str, set[str]]
56+
lazy_modules: set[str]
5757
orig_argv: list[str]
5858
path: list[str]
5959
path_hooks: list[Callable[[str], PathEntryFinderProtocol]]

0 commit comments

Comments
 (0)