classification
Title: io.open_code should accept PathLike objects
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Allow passing Pathlike objects to io.open_code
View: 39691
Assigned To: Nosy List: hauntsaninja, steve.dower, xtreak
Priority: normal Keywords: patch

Created on 2020-02-22 05:43 by hauntsaninja, last changed 2020-02-23 16:55 by steve.dower. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18602 closed hauntsaninja, 2020-02-22 06:54
Messages (3)
msg362446 - (view) Author: Shantanu (hauntsaninja) * Date: 2020-02-22 05:43
Currently io.open_code (added in Python 3.8) only accepts str arguments. As per PEP 519, it should probably also accept PathLike. It might be worth extending it to accept bytes as well, both for convenience and because documentation claims it should be interchangeable with ``open(path, 'rb')``.

https://github.com/python/cpython/blob/3.8/Modules/_io/_iomodule.c#L510
msg362455 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-02-22 09:58
This seems to be a duplicate of https://bugs.python.org/issue39691
msg362523 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-02-23 16:55
Dup of issue39691

As per PEP 578, open_code only accepts an absolute path as a str. The other issue will be used to update the docstring.
History
Date User Action Args
2020-02-23 16:55:12steve.dowersetstatus: open -> closed
superseder: Allow passing Pathlike objects to io.open_code
messages: + msg362523

resolution: duplicate
stage: patch review -> resolved
2020-02-22 09:58:27xtreaksetmessages: + msg362455
2020-02-22 08:17:22SilentGhostsetnosy: + steve.dower

versions: + Python 3.9
2020-02-22 06:54:22hauntsaninjasetkeywords: + patch
stage: patch review
pull_requests: + pull_request17969
2020-02-22 06:33:36xtreaksetnosy: + xtreak
2020-02-22 05:43:48hauntsaninjacreate