Issue 31307: ConfigParser.read silently fails if filenames argument is a byte string (original) (raw)
Created on 2017-08-30 14:15 by vxgmichel, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 3420 | merged | vxgmichel,2017-09-07 12:06 |
Messages (5) | ||
---|---|---|
msg301026 - (view) | Author: Vincent Michel (vxgmichel) * | Date: 2017-08-30 14:15 |
Calling `config_parser.read` with `'test'` is equivalent to: config_parser.read(['test']) while calling `config_parser.read` with `b'test'` is treated as: config_parser.read([116, 101, 115, 116]) which means python will try to open the file descriptors 101, 115 and 116. I don't know if byte path should be supported, but this is probably not the expected behavior. The method code: https://github.com/python/cpython/blob/master/Lib/configparser.py#L678-L702 | ||
msg301149 - (view) | Author: Łukasz Langa (lukasz.langa) * ![]() |
Date: 2017-09-01 19:48 |
Good catch. Supporting bytes passed as a path is a reasonable request since the builtin `open()` supports this, too. Go ahead and create a pull request! We only need to modify line 690 to also list `bytes`. | ||
msg301192 - (view) | Author: David Ellis (David Ellis) * | Date: 2017-09-03 14:02 |
This is related to the issue I'd brought up previously here so closing this would also close that issue: http://bugs.python.org/issue29627 I did originally attempt to add support for bytes in PR where I added support for Path-like objects: https://github.com/python/cpython/pull/242 but I was asked to take it back out. | ||
msg305421 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2017-11-02 12:47 |
New changeset e314853d57450b2b9523157eebd405289a795a0e by Berker Peksag (Vincent Michel) in branch 'master': bpo-31307: Make ConfigParser.read() accept bytes objects (GH-3420) https://github.com/python/cpython/commit/e314853d57450b2b9523157eebd405289a795a0e | ||
msg305422 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2017-11-02 12:49 |
Thanks! I went ahead and merged PR 3420 since Łukasz (the configparser maintainer) has accepted the idea. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:51 | admin | set | github: 75488 |
2017-11-02 12:49:05 | berker.peksag | set | status: open -> closedtype: behavior -> enhancementmessages: + resolution: fixedstage: resolved |
2017-11-02 12:47:06 | berker.peksag | set | nosy: + berker.peksagmessages: + |
2017-09-07 12:06:27 | vxgmichel | set | pull_requests: + <pull%5Frequest3417> |
2017-09-05 17:52:56 | lukasz.langa | link | issue29627 superseder |
2017-09-03 14:02:16 | David Ellis | set | nosy: + David Ellismessages: + |
2017-09-01 19:48:23 | lukasz.langa | set | messages: + |
2017-08-31 12:01:28 | cryvate | set | nosy: + cryvate |
2017-08-30 15:32:59 | r.david.murray | set | nosy: + lukasz.langa |
2017-08-30 14:15:47 | vxgmichel | create |