SIGN IN SIGN UP

bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204)

In [Lib/test/support/import_helper.py](https://github.com/python/cpython/blob/master/Lib/test/support/import_helper.py), the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this.

Automerge-Triggered-By: GH:brettcannon
J
Jason Wilkes committed
da576e08296490e94924421af71001bcfbccb317
Parent: 7a0486e
Committed by GitHub <noreply@github.com> on 2/8/2022, 1:09:07 AM