mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-23835: Enforce that configparser defaults are strings (#2558)
* Enforce that configparser defaults are strings * Update test_configparser.py
This commit is contained in:
parent
9a83f651f3
commit
44e6ad8734
2 changed files with 11 additions and 3 deletions
|
@ -610,9 +610,6 @@ class RawConfigParser(MutableMapping):
|
|||
self._converters = ConverterMapping(self)
|
||||
self._proxies = self._dict()
|
||||
self._proxies[default_section] = SectionProxy(self, default_section)
|
||||
if defaults:
|
||||
for key, value in defaults.items():
|
||||
self._defaults[self.optionxform(key)] = value
|
||||
self._delimiters = tuple(delimiters)
|
||||
if delimiters == ('=', ':'):
|
||||
self._optcre = self.OPTCRE_NV if allow_no_value else self.OPTCRE
|
||||
|
@ -637,6 +634,8 @@ class RawConfigParser(MutableMapping):
|
|||
self._interpolation = Interpolation()
|
||||
if converters is not _UNSET:
|
||||
self._converters.update(converters)
|
||||
if defaults:
|
||||
self.read_dict({default_section: defaults})
|
||||
|
||||
def defaults(self):
|
||||
return self._defaults
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue