summaryrefslogtreecommitdiffstats
path: root/Lib/configparser.py
diff options
context:
space:
mode:
authorCheryl Sabella <cheryl.sabella@gmail.com>2018-06-12 20:37:51 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2018-06-12 20:37:51 (GMT)
commit33cd058f21d0673253c88cea70388282918992bc (patch)
tree939d1aa091d5b69bafc4f75e68acd3aedbdbbfe0 /Lib/configparser.py
parentc3f55be7dd012b7e92901627d0b31c21e983ccb4 (diff)
downloadcpython-33cd058f21d0673253c88cea70388282918992bc.zip
cpython-33cd058f21d0673253c88cea70388282918992bc.tar.gz
cpython-33cd058f21d0673253c88cea70388282918992bc.tar.bz2
bpo-32108: Don't clear configparser values if key is assigned to itself (GH-7588)
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r--Lib/configparser.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py
index ea788ae..4a16101 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -963,7 +963,8 @@ class RawConfigParser(MutableMapping):
def __setitem__(self, key, value):
# To conform with the mapping protocol, overwrites existing values in
# the section.
-
+ if key in self and self[key] is value:
+ return
# XXX this is not atomic if read_dict fails at any point. Then again,
# no update method in configparser is atomic in this implementation.
if key == self.default_section: