diff options
author | ?ukasz Langa <lukasz@langa.pl> | 2012-12-31 13:55:11 +0100 |
---|---|---|
committer | ?ukasz Langa <lukasz@langa.pl> | 2012-12-31 13:55:11 +0100 |
commit | 9d16a2c71b8db60797743c64f0c43407b2649d5d (patch) | |
tree | 239c636bbe6a513e68bc2221c2f92227fd766c0c /Lib/configparser.py | |
parent | 9942fb050c7ad8afd60243f7d26da4f3f536c2ac (diff) | |
download | cpython-9d16a2c71b8db60797743c64f0c43407b2649d5d.tar.gz |
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 be1c9f35da..eac508e412 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): |