diff options
author | Łukasz Langa <lukasz@langa.pl> | 2013-01-01 21:33:19 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2013-01-01 21:33:19 (GMT) |
commit | a821f82f66260601aa184d5788226dd0c64251a0 (patch) | |
tree | 70e366f6ec7c3f6ee28aeceea8b5a1e728901a47 /Lib/configparser.py | |
parent | eb6aa5c52597a1b7d67197ff094f7548728393f0 (diff) | |
download | cpython-a821f82f66260601aa184d5788226dd0c64251a0.zip cpython-a821f82f66260601aa184d5788226dd0c64251a0.tar.gz cpython-a821f82f66260601aa184d5788226dd0c64251a0.tar.bz2 |
configparser: preserve section order when using `__setitem__` (issue #16820)
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r-- | Lib/configparser.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py index eac508e..c7bee6b 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -962,8 +962,8 @@ class RawConfigParser(MutableMapping): # no update method in configparser is atomic in this implementation. if key == self.default_section: self._defaults.clear() - else: - self.remove_section(key) + elif key in self._sections: + self._sections[key].clear() self.read_dict({key: value}) def __delitem__(self, key): |