Issue 12717: ConfigParser._Chainmap error in 2.7.2 (original) (raw)

Created on 2011-08-09 15:07 by mgarabed, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg141823 - (view) Author: Mike Garabedian (mgarabed) Date: 2011-08-09 15:07
Issue 11089 submitted a patch to 3.2 and 2.7 to address performance concerns with the latest updates to ConfigParser. In the implementation for 2.7.2, this patch was misapplied in the keys() function on line 573: for mapping in self_maps: should be: for mapping in self._maps: As a result the following raises a NameError: >>> import ConfigParser >>> ConfigParser._Chainmap() Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\UserDict.py", line 172, in __repr__ return repr(dict(self.iteritems())) File "C:\Python27\lib\UserDict.py", line 110, in iteritems for k in self: File "C:\Python27\lib\UserDict.py", line 97, in __iter__ for k in self.keys(): File "C:\Python27\lib\ConfigParser.py", line 573, in keys for mapping in self_maps: NameError: global name 'self_maps' is not defined
msg141824 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-08-09 15:09
Thanks for catching this. I’m baffled that the test suite did not catch that.
msg141835 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-08-09 18:33
Thanks, I'll fix that shortly.
msg141837 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-08-09 19:07
New changeset 7d5a37ce42d5 by Raymond Hettinger in branch '2.7': Issue 12717: Fix-up an earlier backport in ConfigParser. http://hg.python.org/cpython/rev/7d5a37ce42d5
msg141838 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-08-09 19:10
Fixed. Thanks for the report. Éric, the test suite didn't catch this because the error wasn't user visible -- the chainmap is only used internally and only __getitem__ was needed.
msg141843 - (view) Author: Mike Garabedian (mgarabed) Date: 2011-08-09 21:04
Happy to help! Raymond - I came across this issue while reviewing notes from your OSCON Advanced Python talk - thanks for the great tutorial!
History
Date User Action Args
2022-04-11 14:57:20 admin set github: 56926
2011-08-09 21:04:21 mgarabed set messages: +
2011-08-09 19:10:04 rhettinger set status: open -> closedresolution: fixedmessages: +
2011-08-09 19:07:24 python-dev set nosy: + python-devmessages: +
2011-08-09 18:33:07 rhettinger set priority: normal -> highmessages: +
2011-08-09 15:09:23 eric.araujo set nosy: + eric.araujomessages: + assignee: rhettingertype: compile error -> behaviorstage: test needed
2011-08-09 15:07:32 mgarabed create