homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ConfigParser._Chainmap error in 2.7.2
Type: behavior Stage: test needed
Components: Extension Modules Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: eric.araujo, georg.brandl, lukasz.langa, mgarabed, python-dev, rhettinger, skip.montanaro, skrah, vlachoudis
Priority: high Keywords:

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 "<stdin>", line 1, in <module>
 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:20adminsetgithub: 56926
2011年08月09日 21:04:21mgarabedsetmessages: + msg141843
2011年08月09日 19:10:04rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg141838
2011年08月09日 19:07:24python-devsetnosy: + python-dev
messages: + msg141837
2011年08月09日 18:33:07rhettingersetpriority: normal -> high

messages: + msg141835
2011年08月09日 15:09:23eric.araujosetnosy: + eric.araujo
messages: + msg141824

assignee: rhettinger
type: compile error -> behavior
stage: test needed
2011年08月09日 15:07:32mgarabedcreate

AltStyle によって変換されたページ (->オリジナル) /