]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH...
authorJason Wilkes <notarealdeveloper@gmail.com>
Tue, 8 Feb 2022 01:09:07 +0000 (17:09 -0800)
committerGitHub <noreply@github.com>
Tue, 8 Feb 2022 01:09:07 +0000 (17:09 -0800)
commitda576e08296490e94924421af71001bcfbccb317
treee6967cb02a5a5b512c0cd1e2a4e45a49e85744ad
parent7a0486eaa98083e0407ff491872db6d7a0da2635
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
Lib/test/support/import_helper.py
Misc/NEWS.d/next/Tests/2022-02-07-12-40-45.bpo-46678.zfOrgL.rst [new file with mode: 0644]