mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Merged parser.clean()
fix (issue #16820) from 3.2.
This commit is contained in:
commit
0dc5ab41f0
4 changed files with 48 additions and 1 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue