Fixes __setitem__ on parser['DEFAULT'] reported in issue #16820.

This commit is contained in:
Łukasz Langa 2012-12-31 13:55:11 +01:00
parent 5da57027ef
commit 0210194d48
2 changed files with 32 additions and 1 deletions

View file

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