diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-02-08 21:04:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 21:04:05 (GMT) |
commit | c2735b75afd530631efde4ddd3cb24bbdc285559 (patch) | |
tree | a5708aa6ee2cf54382abb5f02eefbf9f65163702 /Misc/NEWS.d | |
parent | 5b58db75291cfbb9b6785c9845824b3e2da01c1c (diff) | |
download | cpython-c2735b75afd530631efde4ddd3cb24bbdc285559.zip cpython-c2735b75afd530631efde4ddd3cb24bbdc285559.tar.gz cpython-c2735b75afd530631efde4ddd3cb24bbdc285559.tar.bz2 |
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204) (GH-31207)
In `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
(cherry picked from commit da576e08296490e94924421af71001bcfbccb317)
Co-authored-by: Jason Wilkes <notarealdeveloper@gmail.com>
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r-- | Misc/NEWS.d/next/Tests/2022-02-07-12-40-45.bpo-46678.zfOrgL.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Tests/2022-02-07-12-40-45.bpo-46678.zfOrgL.rst b/Misc/NEWS.d/next/Tests/2022-02-07-12-40-45.bpo-46678.zfOrgL.rst new file mode 100644 index 0000000..e369cb1 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-02-07-12-40-45.bpo-46678.zfOrgL.rst @@ -0,0 +1,3 @@ +The function ``make_legacy_pyc`` in ``Lib/test/support/import_helper.py`` no +longer fails when ``PYTHONPYCACHEPREFIX`` is set to a directory on a +different device from where tempfiles are stored. |