summaryrefslogtreecommitdiff
path: root/Lib/configparser.py
diff options
context:
space:
mode:
author?ukasz Langa <lukasz@langa.pl>2012-12-31 03:43:37 +0100
committer?ukasz Langa <lukasz@langa.pl>2012-12-31 03:43:37 +0100
commit8f6fea5c4de0695b0e9a1724420601838d8eb641 (patch)
treea198a57fd06be8357446e3db8466116104f345c3 /Lib/configparser.py
parent7750949296802e28c86a03512ae6f22f4cf7f233 (diff)
parent922e4c8425025d71217f769e5d32f71e78a30b0b (diff)
downloadcpython-8f6fea5c4de0695b0e9a1724420601838d8eb641.tar.gz
Merged `parser.clean()` fix (issue #16820) from 3.2 through 3.3.
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 f18b287893..c0272cd789 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -852,6 +852,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()