From 929aca4026557a460fd74ceb352a01c6c5ba871d Mon Sep 17 00:00:00 2001 From: Neil Mitchell Date: Mon, 19 May 2025 16:55:20 +0100 Subject: [PATCH] Fix MutableMapping.update to require string keys (#14099) --- stdlib/typing.pyi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 5aa85543e..b3d2e88c6 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -797,11 +797,15 @@ class MutableMapping(Mapping[_KT, _VT]): # -- weakref.WeakValueDictionary.__ior__ # -- weakref.WeakKeyDictionary.__ior__ @overload - def update(self, m: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ... + def update(self, m: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ... @overload - def update(self, m: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ... + def update(self: Mapping[str, _VT], m: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ... @overload - def update(self, **kwargs: _VT) -> None: ... + def update(self, m: Iterable[tuple[_KT, _VT]], /) -> None: ... + @overload + def update(self: Mapping[str, _VT], m: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ... + @overload + def update(self: Mapping[str, _VT], **kwargs: _VT) -> None: ... Text = str