diff options
author | James Tocknell <aragilar+github@gmail.com> | 2017-08-21 22:46:30 (GMT) |
---|---|---|
committer | Ćukasz Langa <lukasz@langa.pl> | 2017-08-21 22:46:30 (GMT) |
commit | 44e6ad87340d50f48daf53b6a61138377d0d0d10 (patch) | |
tree | 4292c52f67030aa6223c544d5f4ecf7e7318709c /Lib/configparser.py | |
parent | 9a83f651f31b47b3f6c8b210f7807b26e8c373a5 (diff) | |
download | cpython-44e6ad87340d50f48daf53b6a61138377d0d0d10.zip cpython-44e6ad87340d50f48daf53b6a61138377d0d0d10.tar.gz cpython-44e6ad87340d50f48daf53b6a61138377d0d0d10.tar.bz2 |
bpo-23835: Enforce that configparser defaults are strings (#2558)
* Enforce that configparser defaults are strings
* Update test_configparser.py
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r-- | Lib/configparser.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py index ea971f3..3609240 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -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 |