]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
get(): Fixed a bug in the merge order of the dictionaries. This makes
authorBarry Warsaw <barry@python.org>
Mon, 26 Jan 1998 22:42:48 +0000 (22:42 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 26 Jan 1998 22:42:48 +0000 (22:42 +0000)
a copy of the defaults dictionary and merges the section's dictionary
into it so that sections can override the defaults.

Lib/ConfigParser.py

index 2f3ca519f457a90cc8c2ad34eff010aa0f2c6627..3d44bb52f1c469be71b3e41006fd2f270a4e890f 100644 (file)
@@ -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]