Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue29627

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:configparser.ConfigParser.read() has undocumented/unexpected behaviour when given a bytestring path.
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.7, Python 3.6, Python 3.5
process
Status:closedResolution:duplicate
Dependencies:Superseder: ConfigParser.read silently fails if filenames argument is a byte string
View:31307
Assigned To:Nosy List: David Ellis, lukasz.langa
Priority:normalKeywords:

Created on2017-02-23 00:08 byDavid Ellis, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 3420mergedvxgmichel,2017-09-07 12:06
Messages (1)
msg288394 -(view)Author: David Ellis (David Ellis)*Date: 2017-02-23 00:08
Related:https://github.com/python/cpython/pull/242https://bugs.python.org/issue29623In the discussion over my PR forbpo-29623 it became clear that bytestring paths were also unsupported and it was suggested that that should be a separate issue (currently the PR adds checks for both types).There is some possible odd behaviour as when given a bytestring path the method attempts to open the integer file descriptors for each character in the bytestring. This will most likely fail silently but if it does find an actual file descriptor it will attempt to read and then close the file.Example from the discussion on the PR:>>> import os>>> import configparser>>> k = os.open('/home/david/develop/cpython/Lib/test/cfgparser.1', os.O_RDONLY)>>> k3>>> c = configparser.ConfigParser()>>> c.read(b'\x03') [3]>>> list(c)['DEFAULT', 'Foo Bar']>>> os.close(k)  # File has already been closedOSError: [Errno 9] Bad file descriptorCurrently bytestrings do work correctly when provided as part of a list.
History
DateUserActionArgs
2022-04-11 14:58:43adminsetgithub: 73813
2017-09-07 12:06:28vxgmichelsetpull_requests: +pull_request3418
2017-09-05 17:52:56lukasz.langasetstatus: open -> closed
superseder:ConfigParser.read silently fails if filenames argument is a byte string
resolution: duplicate
stage: resolved
2017-02-23 06:18:09berker.peksagsetnosy: +lukasz.langa
2017-02-23 00:08:04David Elliscreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp