Skip to content

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

Merged
brettcannon merged 1 commit intopython:3.10from
miss-islington:backport-da576e0-3.10
Feb 8, 2022
Merged

[3.10] bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204)#31207
brettcannon merged 1 commit intopython:3.10from
miss-islington:backport-da576e0-3.10

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Feb 8, 2022

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 notarealdeveloper@gmail.com

https://bugs.python.org/issue46678

Automerge-Triggered-By: GH:brettcannon

…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 <notarealdeveloper@gmail.com>
@miss-islington
Copy link
Contributor Author

@notarealdeveloper: Status check is done, and it's a success ✅ .

2 similar comments
@miss-islington
Copy link
Contributor Author

@notarealdeveloper: Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

@notarealdeveloper: Status check is done, and it's a success ✅ .

@brettcannon brettcannon merged commit c2735b7 into python:3.10 Feb 8, 2022
@miss-islington miss-islington deleted the backport-da576e0-3.10 branch February 8, 2022 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants