Title: configparser does not convert defaults to strings
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: aragilar, lukasz.langa, r.david.murray
Priority: normal Keywords: patch

Created on 2015-04-01 04:23 by aragilar, last changed 2017-07-13 10:21 by lukasz.langa.

File name Uploaded Description Edit
py27-config-fix.patch aragilar, 2015-04-08 05:26 review
Pull Requests
URL Status Linked Edit
PR 2558 open aragilar, 2017-07-04 06:10
Messages (6)
msg239768 - (view) Author: James Tocknell (aragilar) * Date: 2015-04-01 04:23
ConfigParser(defaults={1:2.4}) and ConfigParser(defaults={"a":5.2}) cause an exception when configparser tries to perform string operations on 1 and 5.2. I didn't see it documented that defaults must only contain strings, and using ConfigParser['DEFAULT'] = {1:2.4} does the necessary string conversion, so it looks like there should be some conversion done to the defaults.
msg240249 - (view) Author: James Tocknell (aragilar) * Date: 2015-04-08 05:26
Here's a patch for 2.7 (based of the head of the 2.7 branch), something similar could be done for 3.4 (I wasn't sure what branch I was supposed to base the patch off, since 3.4 is inactive). The string requirement was already noted in the docstring of the configparser module, but that's not mentioned in the main docs. Also, I wasn't sure where to put a test in because there was not located in Lib/test.
msg297793 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-06 03:41
I'm guessing we can only do something here in 3.7, for backward compatibility reasons, but maybe I'm wrong.  Hopefully Lukasz will notice the activity on the issue and have time to take a look.
msg298205 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-07-12 12:16
Responded on the PR.
msg298234 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-12 16:50
Thanks.  OK, so you agree a fix is appropriate.  What about the question of backport/backward compatibility?
msg298279 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2017-07-13 10:21
Backwards compatibility will be considered when the patch is ready. I'm not overly worried about fixing a case that currently raises exceptions all over the place. There's few compatibility concerns that we need to consider in this case.
Date User Action Args
2017-07-13 10:21:36lukasz.langasetmessages: + msg298279
2017-07-12 16:50:50r.david.murraysetmessages: + msg298234
2017-07-12 12:16:12lukasz.langasetmessages: + msg298205
2017-07-06 03:41:26r.david.murraysetnosy: + r.david.murray

messages: + msg297793
versions: + Python 3.6, Python 3.7, - Python 3.4
2017-07-04 06:10:32aragilarsetpull_requests: + pull_request2628
2015-04-08 05:26:55aragilarsetfiles: + py27-config-fix.patch
keywords: + patch
messages: + msg240249
2015-04-01 06:59:56serhiy.storchakasetnosy: + lukasz.langa

type: crash -> behavior
versions: + Python 3.5
2015-04-01 04:23:08aragilarcreate