You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pathlib: make _Accessor.open() return a file object and not a file descriptor #84288
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-04-09.22:03:35.867>created_at=<Date2020-03-29.22:37:39.513>labels= ['type-feature', 'library', '3.10']
title='pathlib: make `_Accessor.open()` return a file object and not a file descriptor'updated_at=<Date2021-04-09.22:03:35.867>user='https://github.com/barneygale'
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 / #63038 to land before starting work on this.
Activity
barneygale commentedon Mar 29, 2020
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 likeos.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 likeio.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 / #63038 to land before starting work on this.
zooba commentedon Apr 9, 2021
New changeset 11c3bd3 by Barney Gale in branch 'master':
bpo-40107: Switch to using io.open() for pathlib.Path.open() (GH-25240)
11c3bd3