diff options
author | Andreas Poehlmann <andreas@poehlmann.io> | 2020-11-30 16:34:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 16:34:15 (GMT) |
commit | 0be9ce305ff2b9e13ddcf15af8cfe28786afb36a (patch) | |
tree | 6adbae3b5c36f2c9588e68112f02371e4d995da6 /Lib/collections | |
parent | 9f004634a2bf50c782e223e2eb386ffa769b901c (diff) | |
download | cpython-0be9ce305ff2b9e13ddcf15af8cfe28786afb36a.zip cpython-0be9ce305ff2b9e13ddcf15af8cfe28786afb36a.tar.gz cpython-0be9ce305ff2b9e13ddcf15af8cfe28786afb36a.tar.bz2 |
bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ (GH-23534)
Diffstat (limited to 'Lib/collections')
-rw-r--r-- | Lib/collections/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 5d75501..9c25a2d 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -1001,7 +1001,7 @@ class ChainMap(_collections_abc.MutableMapping): def __iter__(self): d = {} for mapping in reversed(self.maps): - d.update(mapping) # reuses stored hash values if possible + d.update(dict.fromkeys(mapping)) # reuses stored hash values if possible return iter(d) def __contains__(self, key): |