Skip to content

Commit f60d6cb

Browse files
committed
Use open() to write the bytecode
1 parent c8ba03f commit f60d6cb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ def _write_atomic(path, data, mode=0o666):
208208
try:
209209
# We first write data to a temporary file, and then use os.replace() to
210210
# perform an atomic rename.
211-
with _io.FileIO(fd, 'wb') as file, _io.BufferedWriter(file) as writer:
212-
writer.write(data)
211+
with _io.open(fd, 'wb') as file:
212+
file.write(data)
213213
_os.replace(path_tmp, path)
214214
except OSError:
215215
try:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Use ``BufferedWriter`` to ensure that writes to ``.pyc`` files are retried, or an appropriate error is raised.
1+
Use Python's regular file object to ensure that writes to ``.pyc`` files are retried, or an appropriate error is raised.

0 commit comments

Comments
 (0)