-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py #31204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py #31204
Conversation
os.rename fails if the source and target live on different devices. This can occur in Lib/test/support/import_helper.py (for example) if /tmp is mounted as a ramdisk, or more generally if PYTHONPYCACHEPREFIX is set to a directory on a different drive from where temporary files are stored.
Sorry, I can't merge this PR. Reason: |
Sorry, I can't merge this PR. Reason: |
1 similar comment
Sorry, I can't merge this PR. Reason: |
@notarealdeveloper: Status check is done, and it's a success ✅ . |
Thanks @notarealdeveloper for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
Sorry, @notarealdeveloper, I could not cleanly backport this to |
…elper.py (pythonGH-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 (cherry picked from commit da576e0) Co-authored-by: Jason Wilkes <[email protected]>
GH-31207 is a backport of this pull request to the 3.10 branch. |
…elper.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 da576e0) Co-authored-by: Jason Wilkes <[email protected]>
In Lib/test/support/import_helper.py, the function
make_legacy_pyc
makes a call toos.rename
which can fail when the source and target live on different devices. This happens (for example) whenPYTHONPYCACHEPREFIX
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). Replacingos.rename
withshutil.move
fixes this.https://bugs.python.org/issue46678
Automerge-Triggered-By: GH:brettcannon