mirror of https://github.com/python/cpython
get(): Fixed a bug in the merge order of the dictionaries. This makes
a copy of the defaults dictionary and merges the section's dictionary into it so that sections can override the defaults.
This commit is contained in:
parent
c6c921a4de
commit
5da0f504ba
|
@ -164,13 +164,14 @@ class ConfigParser:
|
|||
The section DEFAULT is special.
|
||||
"""
|
||||
try:
|
||||
d = self.__sections[section].copy()
|
||||
sectdict = self.__sections[section].copy()
|
||||
except KeyError:
|
||||
if section == DEFAULTSECT:
|
||||
d = {}
|
||||
sectdict = {}
|
||||
else:
|
||||
raise NoSectionError(section)
|
||||
d.update(self.__defaults)
|
||||
d = self.__defaults.copy()
|
||||
d.update(sectdict)
|
||||
option = string.lower(option)
|
||||
try:
|
||||
rawval = d[option]
|
||||
|
|
Loading…
Reference in New Issue