From 29061d36aefa9978a2081669f711a8342aba0fe4 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Tue, 23 Mar 2021 03:30:01 +0100 Subject: [PATCH] Fix dict type if constructing with kwargs (#4987) Closes #4846 --- stdlib/builtins.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 4cf5a8058..ff2312727 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -753,10 +753,10 @@ class list(MutableSequence[_T], Generic[_T]): def __class_getitem__(cls, item: Any) -> GenericAlias: ... class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): - # NOTE: Keyword arguments are special. If they are used, _KT must include - # str, but we have no way of enforcing it here. @overload - def __init__(self, **kwargs: _VT) -> None: ... + def __init__(self: Dict[_KT, _VT]) -> None: ... + @overload + def __init__(self: Dict[str, _VT], **kwargs: _VT) -> None: ... @overload def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ... @overload