Skip to content

Commit fa06483

Browse files
author
Guido van Rossum
committed
Unconditionally use os.replace() instead of os.rename().
Don't merge until we've officially dropped Python 3.2 support.
1 parent f3b1dc4 commit fa06483

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

mypy/build.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -839,14 +839,8 @@ def write_cache(id: str, path: str, tree: MypyFile,
839839
with open(meta_json_tmp, 'w') as f:
840840
json.dump(meta, f, sort_keys=True)
841841
f.write('\n')
842-
# TODO: This is a temporary change until Python 3.2 support is dropped, see #1504
843-
# os.rename will raise an exception rather than replace files on Windows
844-
try:
845-
replace = os.replace
846-
except AttributeError:
847-
replace = os.rename
848-
replace(data_json_tmp, data_json)
849-
replace(meta_json_tmp, meta_json)
842+
os.replace(data_json_tmp, data_json)
843+
os.replace(meta_json_tmp, meta_json)
850844

851845

852846
"""Dependency manager.

0 commit comments

Comments
 (0)