Skip to content

Commit 4246f5d

Browse files
committed
bpo-40107: stop using os.open() to implement pathlib.Path.open()
1 parent b05440c commit 4246f5d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Lib/pathlib.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class _NormalAccessor(_Accessor):
393393

394394
stat = os.stat
395395

396-
open = os.open
396+
open = io.open
397397

398398
listdir = os.listdir
399399

@@ -1087,10 +1087,6 @@ def __exit__(self, t, v, tb):
10871087
# removed in the future.
10881088
pass
10891089

1090-
def _opener(self, name, flags, mode=0o666):
1091-
# A stub for the opener argument to built-in open()
1092-
return self._accessor.open(self, flags, mode)
1093-
10941090
# Public API
10951091

10961092
@classmethod
@@ -1212,8 +1208,8 @@ def open(self, mode='r', buffering=-1, encoding=None,
12121208
"""
12131209
if "b" not in mode:
12141210
encoding = io.text_encoding(encoding)
1215-
return io.open(self, mode, buffering, encoding, errors, newline,
1216-
opener=self._opener)
1211+
return self._accessor.open(self, mode, buffering, encoding, errors,
1212+
newline)
12171213

12181214
def read_bytes(self):
12191215
"""

0 commit comments

Comments
 (0)