mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
configparser: preserve section order when using __setitem__
(issue #16820)
This commit is contained in:
parent
e4110dc11f
commit
a2e7acd17d
2 changed files with 28 additions and 1 deletions
|
@ -959,7 +959,8 @@ 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 in self._sections:
|
||||
self._sections[key].clear()
|
||||
self.read_dict({key: value})
|
||||
|
||||
def __delitem__(self, key):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue