mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-33251: Prevent ConfigParser.items returning items present in vars. (#6446)
* bpo-33251: ConfigParser.items no longer returns items present in vars. Documentation for `ConfigParser.items()` states: 'Items present in vars no longer appear in the result.' This fix aligns behaviour to that specified in the documentation.
This commit is contained in:
parent
25038ecfb6
commit
1d4a733cce
3 changed files with 6 additions and 5 deletions
|
@ -846,6 +846,7 @@ class RawConfigParser(MutableMapping):
|
|||
except KeyError:
|
||||
if section != self.default_section:
|
||||
raise NoSectionError(section)
|
||||
orig_keys = list(d.keys())
|
||||
# Update with the entry specific variables
|
||||
if vars:
|
||||
for key, value in vars.items():
|
||||
|
@ -854,7 +855,7 @@ class RawConfigParser(MutableMapping):
|
|||
section, option, d[option], d)
|
||||
if raw:
|
||||
value_getter = lambda option: d[option]
|
||||
return [(option, value_getter(option)) for option in d.keys()]
|
||||
return [(option, value_getter(option)) for option in orig_keys]
|
||||
|
||||
def popitem(self):
|
||||
"""Remove a section from the parser and return it as
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue