diff options
author | Łukasz Langa <lukasz@langa.pl> | 2012-12-31 02:43:37 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2012-12-31 02:43:37 (GMT) |
commit | 1dce0003a662c8d1adf664b598b7941ad83bf23b (patch) | |
tree | bf014f95dacb7e6ff71baa6439959feb6afed1d1 /Lib/configparser.py | |
parent | 641bb6607025689871839cbd275f5e4b5e16f5a4 (diff) | |
parent | 0dc5ab41f07a26deaebe46f593e572e221772aa2 (diff) | |
download | cpython-1dce0003a662c8d1adf664b598b7941ad83bf23b.zip cpython-1dce0003a662c8d1adf664b598b7941ad83bf23b.tar.gz cpython-1dce0003a662c8d1adf664b598b7941ad83bf23b.tar.bz2 |
Merged `parser.clean()` fix (issue #16820) from 3.2 through 3.3.
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r-- | Lib/configparser.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py index f18b287..c0272cd 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() |