Issue 33802: Regression in logging configuration (original) (raw)
This looks like a serious regression in 3.7. @ned.deily - I'm marking this as a release blocker, but feel free of course to downgrade it.
Run the following as
$ python3.6 badconfig.py Hey, it works!
$ python3.7 badconfig.py Traceback (most recent call last): File "../badconfig.py", line 77, in fileConfig(inifile.name, defaults=GUNICORN_DEFAULTS) File "/Users/barry/projects/python/cpython/Lib/logging/config.py", line 65, in fileConfig cp = configparser.ConfigParser(defaults) File "/Users/barry/projects/python/cpython/Lib/configparser.py", line 639, in init self._read_defaults(defaults) File "/Users/barry/projects/python/cpython/Lib/configparser.py", line 1212, in _read_defaults self.read_dict({self.default_section: defaults}) File "/Users/barry/projects/python/cpython/Lib/configparser.py", line 754, in read_dict self.set(section, key, value) File "/Users/barry/projects/python/cpython/Lib/configparser.py", line 1200, in set super().set(section, option, value) File "/Users/barry/projects/python/cpython/Lib/configparser.py", line 895, in set value) File "/Users/barry/projects/python/cpython/Lib/configparser.py", line 403, in before_set "position %d" % (value, tmp_value.find('%'))) ValueError: invalid interpolation syntax in "{'generic': {'format': '%(asctime)s [%(process)d] [%(levelname)s] %(message)s', 'datefmt': '[%Y-%m-%d %H:%M:%S %z]', 'class': 'logging.Formatter'}}" at position 26
I'm still investigating, but wanted to get the bug filed asap.
It seems like this regression has not completely been fixed: there are still issues with "None":
$ python3.6 -c 'import configparser; configparser.ConfigParser(defaults={"a": None})'
$ python3.7 -c 'import configparser; configparser.ConfigParser(defaults={"a": 1})'
$ python3.7 -c 'import configparser; configparser.ConfigParser(defaults={"a": None})' Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.7/configparser.py", line 638, in init self._read_defaults(defaults) File "/usr/lib/python3.7/configparser.py", line 1216, in _read_defaults self.read_dict({self.default_section: defaults}) File "/usr/lib/python3.7/configparser.py", line 753, in read_dict self.set(section, key, value) File "/usr/lib/python3.7/configparser.py", line 1197, in set self._validate_value_types(option=option, value=value) File "/usr/lib/python3.7/configparser.py", line 1182, in _validate_value_types raise TypeError("option values must be strings") TypeError: option values must be strings
Should "None" not be used, or should this bug be reopened?