Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40107: stop using os.open() to implement pathlib.Path.open() #25240

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class _NormalAccessor(_Accessor):

stat = os.stat

open = os.open
open = io.open

listdir = os.listdir

Expand Down Expand Up @@ -1087,10 +1087,6 @@ def __exit__(self, t, v, tb):
# removed in the future.
pass

def _opener(self, name, flags, mode=0o666):
# A stub for the opener argument to built-in open()
return self._accessor.open(self, flags, mode)

# Public API

@classmethod
Expand Down Expand Up @@ -1212,8 +1208,8 @@ def open(self, mode='r', buffering=-1, encoding=None,
"""
if "b" not in mode:
encoding = io.text_encoding(encoding)
return io.open(self, mode, buffering, encoding, errors, newline,
opener=self._opener)
return self._accessor.open(self, mode, buffering, encoding, errors,
newline)

def read_bytes(self):
"""
Expand Down