Make self and cls positional-only in dict constructor methods (#15262)

This commit is contained in:
Alex Waygood
2026-01-11 18:21:07 +00:00
committed by GitHub
parent 5a45a9a5bc
commit a4eeb5c05b
+3 -3
View File
@@ -1176,9 +1176,9 @@ class dict(MutableMapping[_KT, _VT]):
# __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics
# Also multiprocessing.managers.SyncManager.dict()
@overload
def __init__(self) -> None: ...
def __init__(self, /) -> None: ...
@overload
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
def __init__(self: dict[str, _VT], /, **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
@overload
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
@overload
@@ -1203,7 +1203,7 @@ class dict(MutableMapping[_KT, _VT]):
def __init__(self: dict[str, str], iterable: Iterable[list[str]], /) -> None: ...
@overload
def __init__(self: dict[bytes, bytes], iterable: Iterable[list[bytes]], /) -> None: ...
def __new__(cls, *args: Any, **kwargs: Any) -> Self: ...
def __new__(cls, /, *args: Any, **kwargs: Any) -> Self: ...
def copy(self) -> dict[_KT, _VT]: ...
def keys(self) -> dict_keys[_KT, _VT]: ...
def values(self) -> dict_values[_KT, _VT]: ...