diff options
author | Łukasz Langa <lukasz@langa.pl> | 2012-12-31 12:55:11 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2012-12-31 12:55:11 (GMT) |
commit | 0210194d48569ce136bad4d324ade03767356905 (patch) | |
tree | 13597f978bb3323a9d33d937a241ebf0d2d0dcb4 /Lib/configparser.py | |
parent | 5da57027efb830f1bb6dfeecade94faee28b21ae (diff) | |
download | cpython-0210194d48569ce136bad4d324ade03767356905.zip cpython-0210194d48569ce136bad4d324ade03767356905.tar.gz cpython-0210194d48569ce136bad4d324ade03767356905.tar.bz2 |
Fixes `__setitem__` on parser['DEFAULT'] reported in issue #16820.
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r-- | Lib/configparser.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py index be1c9f3..eac508e 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -960,7 +960,10 @@ class RawConfigParser(MutableMapping): # XXX this is not atomic if read_dict fails at any point. Then again, # no update method in configparser is atomic in this implementation. - self.remove_section(key) + if key == self.default_section: + self._defaults.clear() + else: + self.remove_section(key) self.read_dict({key: value}) def __delitem__(self, key): |