This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pathlib: make `_Accessor.open()` return a file object and not a file descriptor
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: barneygale, steve.dower
Priority: normal Keywords: patch

Created on 2020-03-29 22:37 by barneygale, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25240 merged barneygale, 2021-04-07 01:28
Messages (2)
msg365283 - (view) Author: Barney Gale (barneygale) * Date: 2020-03-29 22:37
This is one of a series of bug reports / PRs that lay the groundwork for making pathlib extensible. See here for detail: https://discuss.python.org/t/make-pathlib-extensible/3428

Currently `_Accessor.open()` is expected to function like `os.open()` and return a file descriptor. I'd suggest this interface is too low-level if our eventual aim is to allow users to implement their own accessor.

It would be better is `_Accessor.open()` is expected to function like `io.open()` and return a file object. That way, accessors don't need to deal with file descriptors at all, which is important if they're working with remote filesystems.

I'm planning to wait for bpo-39895 / gh-18838 to land before starting work on this.
msg390667 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-04-09 20:52
New changeset 11c3bd3f6d06649484b81a659c7bf02d6632e607 by Barney Gale in branch 'master':
bpo-40107: Switch to using io.open() for pathlib.Path.open() (GH-25240)
https://github.com/python/cpython/commit/11c3bd3f6d06649484b81a659c7bf02d6632e607
History
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84288
2021-04-09 22:03:35steve.dowersetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.10, - Python 3.9
2021-04-09 20:52:55steve.dowersetnosy: + steve.dower
messages: + msg390667
2021-04-07 01:28:40barneygalesetkeywords: + patch
stage: patch review
pull_requests: + pull_request23978
2020-03-29 22:37:39barneygalecreate