
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2018-06-07 23:00 bybarry, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| badconfig.py | barry,2018-06-07 23:00 | |||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 7509 | closed | barry,2018-06-08 00:45 | |
| PR 7524 | merged | lukasz.langa,2018-06-08 09:19 | |
| PR 7529 | merged | miss-islington,2018-06-08 11:04 | |
| PR 21994 | rhettinger,2020-08-29 16:34 | ||
| PR 21986 | koubaa,2020-09-07 15:38 | ||
| PR 22205 | adelfino,2020-09-15 20:22 | ||
| PR 22651 | kevans,2020-10-11 20:42 | ||
| Messages (7) | |||
|---|---|---|---|
| msg318980 -(view) | Author: Barry A. Warsaw (barry)*![]() | Date: 2018-06-07 23:00 | |
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.pyHey, it works!$ python3.7 badconfig.pyTraceback (most recent call last): File "../badconfig.py", line 77, in <module> 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 26I'm still investigating, but wanted to get the bug filed asap. | |||
| msg318984 -(view) | Author: Barry A. Warsaw (barry)*![]() | Date: 2018-06-07 23:22 | |
I think the regression is caused by the fix forbpo-23835https://bugs.python.org/issue23835 | |||
| msg319037 -(view) | Author: Łukasz Langa (lukasz.langa)*![]() | Date: 2018-06-08 09:22 | |
I'm very sorry for the trouble! And impressed at Barry's quick diagnosis. | |||
| msg319046 -(view) | Author: Łukasz Langa (lukasz.langa)*![]() | Date: 2018-06-08 11:02 | |
New changeset214f18e49feb6a9d6c05aa09a4bb304905e81334 by Łukasz Langa in branch 'master':bpo-33802: Do not interpolate in ConfigParser while reading defaults (GH-7524)https://github.com/python/cpython/commit/214f18e49feb6a9d6c05aa09a4bb304905e81334 | |||
| msg319065 -(view) | Author: miss-islington (miss-islington) | Date: 2018-06-08 14:01 | |
New changesetf44203d782e397941c17d96e6a1f9dc1df08b3e6 by Miss Islington (bot) in branch '3.7':bpo-33802: Do not interpolate in ConfigParser while reading defaults (GH-7524)https://github.com/python/cpython/commit/f44203d782e397941c17d96e6a1f9dc1df08b3e6 | |||
| msg323213 -(view) | Author: Steap (Steap) | Date: 2018-08-06 15:39 | |
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 "<string>", line 1, in <module> 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 stringsShould "None" not be used, or should this bug be reopened? | |||
| msg323291 -(view) | Author: Łukasz Langa (lukasz.langa)*![]() | Date: 2018-08-08 15:14 | |
None is an invalid value in the configparser. It only accepts strings. See:>>> cp = ConfigParser()>>> cp['asd'] = {'a': None}Traceback (most recent call last):...TypeError: option values must be stringsThe DEFAULT section was an omission which is now fixed. You can use a RawConfigParser if you want to put invalid types as option values:>>> rcp = RawConfigParser()>>> rcp['asd'] = {'a': None}>>> | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:01 | admin | set | github: 77983 |
| 2020-10-11 20:42:06 | kevans | set | nosy: +kevans pull_requests: +pull_request21629 |
| 2020-10-03 13:38:41 | adelfino | set | nosy: -adelfino |
| 2020-10-03 07:09:33 | scoder | set | nosy: -scoder |
| 2020-10-03 07:09:21 | scoder | set | pull_requests: -pull_request21521 |
| 2020-10-03 06:56:08 | scoder | set | nosy: +scoder pull_requests: +pull_request21521 |
| 2020-09-15 20:22:21 | adelfino | set | nosy: +adelfino pull_requests: +pull_request21317 |
| 2020-09-07 15:38:07 | koubaa | set | nosy: +koubaa pull_requests: +pull_request21220 |
| 2020-09-07 07:38:17 | kulikjak | set | nosy: -kulikjak |
| 2020-09-07 07:38:12 | kulikjak | set | pull_requests: -pull_request21199 |
| 2020-09-05 19:32:02 | kulikjak | set | nosy: +kulikjak pull_requests: +pull_request21199 |
| 2020-08-29 16:34:00 | rhettinger | set | nosy: +rhettinger pull_requests: +pull_request21112 |
| 2018-08-08 15:14:16 | lukasz.langa | set | messages: +msg323291 |
| 2018-08-06 15:39:08 | Steap | set | nosy: +Steap messages: +msg323213 |
| 2018-06-08 16:55:14 | barry | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-06-08 14:01:58 | miss-islington | set | nosy: +miss-islington messages: +msg319065 |
| 2018-06-08 11:04:00 | miss-islington | set | pull_requests: +pull_request7164 |
| 2018-06-08 11:02:52 | lukasz.langa | set | messages: +msg319046 |
| 2018-06-08 10:04:35 | vinay.sajip | set | nosy: +vinay.sajip |
| 2018-06-08 09:22:13 | lukasz.langa | set | messages: +msg319037 |
| 2018-06-08 09:19:48 | lukasz.langa | set | pull_requests: +pull_request7152 |
| 2018-06-08 03:39:17 | ned.deily | set | nosy: +lukasz.langa |
| 2018-06-08 00:45:25 | barry | set | keywords: +patch stage: needs patch -> patch review pull_requests: +pull_request7137 |
| 2018-06-07 23:22:14 | barry | set | messages: +msg318984 |
| 2018-06-07 23:00:35 | barry | create | |