Skip to content

Commit fc33ba6

Browse files
authored
builtins: updates for py313 (#12028)
1 parent 966fbfb commit fc33ba6

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ asyncio.streams.StreamWriter.__del__
4747
bdb.Bdb.dispatch_opcode
4848
bdb.Bdb.set_stepinstr
4949
bdb.Bdb.user_opcode
50-
builtins.IncompleteInputError
51-
builtins.PythonFinalizationError
52-
builtins.property.__name__
53-
builtins.str.format_map
54-
builtins.str.replace
5550
codecs.backslashreplace_errors
5651
codecs.ignore_errors
5752
codecs.namereplace_errors
@@ -316,6 +311,7 @@ _weakref.ProxyType.__reversed__ # Doesn't really exist
316311
argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group # deprecated, forwards arguments to super
317312
ast.ImportFrom.level # None on the class, but never None on instances
318313
builtins.property.__set_name__ # Doesn't actually exist
314+
builtins.str.format_map # stubtest says `mapping` is pos-or-keyword but in reality it is pos-only
319315
collections\.UserList\.index # ignoring pos-or-keyword parameter
320316
dataclasses.KW_ONLY # white lies around defaults
321317
enum.auto.__init__ # The stub for enum.auto is nothing like the implementation

stdlib/builtins.pyi

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ class str(Sequence[str]):
461461
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
462462
@overload
463463
def format(self, *args: object, **kwargs: object) -> str: ...
464-
def format_map(self, map: _FormatMapMapping) -> str: ...
464+
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
465465
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
466466
def isalnum(self) -> bool: ...
467467
def isalpha(self) -> bool: ...
@@ -495,10 +495,20 @@ class str(Sequence[str]):
495495
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
496496
@overload
497497
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
498-
@overload
499-
def replace(self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /) -> LiteralString: ...
500-
@overload
501-
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
498+
if sys.version_info >= (3, 13):
499+
@overload
500+
def replace(
501+
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
502+
) -> LiteralString: ...
503+
@overload
504+
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
505+
else:
506+
@overload
507+
def replace(
508+
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
509+
) -> LiteralString: ...
510+
@overload
511+
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
502512
if sys.version_info >= (3, 9):
503513
@overload
504514
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
@@ -1214,6 +1224,9 @@ class property:
12141224
fset: Callable[[Any, Any], None] | None
12151225
fdel: Callable[[Any], None] | None
12161226
__isabstractmethod__: bool
1227+
if sys.version_info >= (3, 13):
1228+
__name__: str
1229+
12171230
def __init__(
12181231
self,
12191232
fget: Callable[[Any], Any] | None = ...,
@@ -2057,3 +2070,7 @@ if sys.version_info >= (3, 11):
20572070
def split(
20582071
self, condition: Callable[[_ExceptionT_co | Self], bool], /
20592072
) -> tuple[ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None]: ...
2073+
2074+
if sys.version_info >= (3, 13):
2075+
class IncompleteInputError(SyntaxError): ...
2076+
class PythonFinalizationError(RuntimeError): ...

0 commit comments

Comments
 (0)