[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset cf22aa3bc698847459a6bf20c166aa80825b810a by Miss Islington (bot) 
in branch '3.9':
bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ 
(GH-23534) (GH-23569)
https://github.com/python/cpython/commit/cf22aa3bc698847459a6bf20c166aa80825b810a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-30 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +22450
pull_request: https://github.com/python/cpython/pull/23569

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 0be9ce305ff2b9e13ddcf15af8cfe28786afb36a by Andreas Poehlmann in 
branch 'master':
bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ 
(GH-23534)
https://github.com/python/cpython/commit/0be9ce305ff2b9e13ddcf15af8cfe28786afb36a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I had a discussion with the release manager and we're good to backport to 3.9 
but not 3.8.

Serhiy, would you also take a look at this?

--
assignee:  -> rhettinger
nosy: +lukasz.langa, rhettinger, serhiy.storchaka
versions: +Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-27 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
type: behavior -> performance
versions:  -Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-27 Thread Andreas Poehlmann


Change by Andreas Poehlmann :


--
keywords: +patch
pull_requests: +22416
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23534

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42487] collections.ChainMap.__iter__ calls __getitem__ on underlying maps

2020-11-27 Thread Andreas Poehlmann


New submission from Andreas Poehlmann :

Hello,

I encountered an issue with collections.ChainMap, that was introduced when 
https://bugs.python.org/issue32792 got fixed.

Iterating a ChainMap will call __getitem__ on its underlying maps:


>>> from collections import UserDict, ChainMap
>>> class MyDict(UserDict):
... def __getitem__(self, k):
... print("expensive computation", k)
... return super().__getitem__(k)
... 
>>> set(ChainMap(MyDict(a=1, b=2, c=3)))
expensive computation a
expensive computation b
expensive computation c
{'c', 'b', 'a'}

--
components: Library (Lib)
messages: 381971
nosy: ap--
priority: normal
severity: normal
status: open
title: collections.ChainMap.__iter__ calls __getitem__ on underlying maps
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com