From 06919a8b36394f1b3e16ef4dbac823ecdd9de7d9 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Fri, 13 Dec 2024 00:24:52 -0800 Subject: [PATCH] ChainMap.fromkeys is positional-only --- stdlib/@tests/stubtest_allowlists/common.txt | 3 +-- stdlib/collections/__init__.pyi | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 9000131fde9c..de133adb4284 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -11,7 +11,6 @@ _collections_abc.AsyncGenerator.ag_running asyncio.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them asyncio.base_events.BaseEventLoop.subprocess_exec # BaseEventLoop adds several parameters and stubtest fails on the difference if we add them builtins.dict.get -collections\.ChainMap\.fromkeys # https://github.com/python/mypy/issues/17023 contextlib._GeneratorContextManagerBase.__init__ # skipped in the stubs in favor of its child classes ctypes.CDLL._FuncPtr # None at class level but initialized in __init__ to this value ctypes.memmove # CFunctionType @@ -39,7 +38,7 @@ tkinter.simpledialog.[A-Z_]+ tkinter.simpledialog.TclVersion tkinter.simpledialog.TkVersion tkinter.Misc.after # we intentionally don't allow everything that "works" at runtime -tkinter.Text.count # stubtest somehow thinks that index1 parameter has a default value, but it doesn't in any of the overloads +tkinter.Text.count # https://github.com/python/mypy/issues/17023 mixed pos-or-kw and pos-only params confuse stubtest unittest.mock.patch # It's a complicated overload and I haven't been able to figure out why stubtest doesn't like it weakref.WeakKeyDictionary.update weakref.WeakValueDictionary.update diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 2d136318813c..40ad5e0d48dd 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -478,7 +478,7 @@ class ChainMap(MutableMapping[_KT, _VT]): # so the signature should be kept in line with `dict.fromkeys`. @classmethod @overload - def fromkeys(cls, iterable: Iterable[_T]) -> ChainMap[_T, Any | None]: ... + def fromkeys(cls, iterable: Iterable[_T], /) -> ChainMap[_T, Any | None]: ... @classmethod @overload # Special-case None: the user probably wants to add non-None values later.