From: Barry Warsaw Date: Mon, 26 Jan 1998 22:42:48 +0000 (+0000) Subject: get(): Fixed a bug in the merge order of the dictionaries. This makes X-Git-Tag: v1.5.1~889 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5da0f504baa10c6125b5c7cc6dccc801f26f5ff0;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py index 2f3ca519f457..3d44bb52f1c4 100644 --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -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]