configparser: preserve section order when using __setitem__ (issue #16820)

This commit is contained in:
Łukasz Langa 2013-01-01 22:33:19 +01:00
parent eb6aa5c525
commit a821f82f66
2 changed files with 6 additions and 2 deletions

View file

@ -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):