Skip to content

Commit 9a50bff

Browse files
emmatypingAA-Turner
andcommitted
Use io.open instead of builtins.open
Co-authored-by: Adam Turner <[email protected]>
1 parent fba0f1c commit 9a50bff

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Lib/compression/zstd/_zstdfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import builtins
21
import io
32

43
from os import PathLike
@@ -95,7 +94,7 @@ def __init__(
9594
if isinstance(filename, (str, bytes, PathLike)):
9695
if "b" not in mode:
9796
mode += "b"
98-
self._fp = builtins.open(filename, mode)
97+
self._fp = io.open(filename, mode)
9998
self._closefp = True
10099
elif hasattr(filename, "read") or hasattr(filename, "write"):
101100
self._fp = filename

Lib/test/test_zstd/test_core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io
44
import pathlib
55
import random
6-
import builtins
76
import re
87
import os
98
import unittest
@@ -95,7 +94,7 @@ def setUpModule():
9594
b'a' * (32*_1K)
9695

9796
global THIS_FILE_BYTES, THIS_FILE_STR
98-
with builtins.open(os.path.abspath(__file__), 'rb') as f:
97+
with io.open(os.path.abspath(__file__), 'rb') as f:
9998
THIS_FILE_BYTES = f.read()
10099
THIS_FILE_BYTES = re.sub(rb'\r?\n', rb'\n', THIS_FILE_BYTES)
101100
THIS_FILE_STR = THIS_FILE_BYTES.decode('utf-8')

0 commit comments

Comments
 (0)