]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-117215 Make the fromskey() signature match dict.fromkeys(). (gh-117493)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Wed, 3 Apr 2024 15:08:18 +0000 (10:08 -0500)
committerGitHub <noreply@github.com>
Wed, 3 Apr 2024 15:08:18 +0000 (10:08 -0500)
Lib/collections/__init__.py

index 2a35989ee25a5e54e1f864ce1d115d90e8600931..d06d84cbdfcc364883d1e4a6439b33a5028e7957 100644 (file)
@@ -1038,9 +1038,9 @@ class ChainMap(_collections_abc.MutableMapping):
         return f'{self.__class__.__name__}({", ".join(map(repr, self.maps))})'
 
     @classmethod
-    def fromkeys(cls, iterable, *args):
-        'Create a ChainMap with a single dict created from the iterable.'
-        return cls(dict.fromkeys(iterable, *args))
+    def fromkeys(cls, iterable, value=None, /):
+        'Create a new ChainMap with keys from iterable and values set to value.'
+        return cls(dict.fromkeys(iterable, value))
 
     def copy(self):
         'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]'