summaryrefslogtreecommitdiffstats
path: root/Lib/configparser.py
diff options
context:
space:
mode:
authorŁukasz Langa <lukasz@langa.pl>2012-12-31 02:38:39 (GMT)
committerŁukasz Langa <lukasz@langa.pl>2012-12-31 02:38:39 (GMT)
commit3a8479a5838e0ad4c549d67acfdae2b9e9700e54 (patch)
tree9acf3eb02f12ce39a73539d41b3f3227e1f6f3d7 /Lib/configparser.py
parent30574695067f948c2ee40d44c06d71e16c6b90f9 (diff)
downloadcpython-3a8479a5838e0ad4c549d67acfdae2b9e9700e54.zip
cpython-3a8479a5838e0ad4c549d67acfdae2b9e9700e54.tar.gz
cpython-3a8479a5838e0ad4c549d67acfdae2b9e9700e54.tar.bz2
Fixes `parser.clean()` reported in issue #16820.
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r--Lib/configparser.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py
index 06d594a..243efec 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -851,6 +851,19 @@ class RawConfigParser(MutableMapping):
value_getter = lambda option: d[option]
return [(option, value_getter(option)) for option in d.keys()]
+ def popitem(self):
+ """Remove a section from the parser and return it as
+ a (section_name, section_proxy) tuple. If no section is present, raise
+ KeyError.
+
+ The section DEFAULT is never returned because it cannot be removed.
+ """
+ for key in self.sections():
+ value = self[key]
+ del self[key]
+ return key, value
+ raise KeyError
+
def optionxform(self, optionstr):
return optionstr.lower()