FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-40107: stop using os.open() to implement pathlib.Path.open() by barneygale · Pull Request #25240 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 3 additions & 7 deletions Lib/pathlib.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL