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.
|
The section DEFAULT is special.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
d = self.__sections[section].copy()
|
sectdict = self.__sections[section].copy()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if section == DEFAULTSECT:
|
if section == DEFAULTSECT:
|
||||||
d = {}
|
sectdict = {}
|
||||||
else:
|
else:
|
||||||
raise NoSectionError(section)
|
raise NoSectionError(section)
|
||||||
d.update(self.__defaults)
|
d = self.__defaults.copy()
|
||||||
|
d.update(sectdict)
|
||||||
option = string.lower(option)
|
option = string.lower(option)
|
||||||
try:
|
try:
|
||||||
rawval = d[option]
|
rawval = d[option]
|
||||||
|
|
Loading…
Reference in New Issue