Uh oh!
There was an error while loading. Please reload this page.
gh-143768: rebuild broken interpreter symlinks - #143770
Conversation
try again news again
2817914 to
332c799CompareUh oh!
There was an error while loading. Please reload this page.
aisk
commented
Jan 13, 2026
Hi, please avoid force push in the future, see the Dev Guide: https://devguide.python.org/getting-started/pull-request-lifecycle/#don-t-force-push |
claydugo
commented
Jan 13, 2026
Oops sorry about that! |
This PR is stale because it has been open for 30 days with no activity. |
gaborbernat
left a comment
There was a problem hiding this comment.
The fix is correct and well-scoped: os.path.islink(dst) and not os.path.exists(dst) targets only dangling symlinks and completes venv's existing overwrite path without adding repair semantics. Background and the virtualenv comparison are in #143768.
The regression test covers symlinks=True only, but the failure in the original report is the --copies path, which raises a different exception (FileNotFoundError [Errno 2] during the copy) than the symlinks path. The fix already handles it, so the test should cover it too; otherwise the exact reported scenario has no regression coverage. See the inline suggestion.
| self.assertTrue(os.path.islink(python)) | ||
| self.assertFalse(os.path.exists(python)) | ||
| builder = venv.EnvBuilder(with_pip=False, symlinks=True) |
There was a problem hiding this comment.
Add a symlinks=False (--copies) case so the path from the original report is covered:
builder=venv.EnvBuilder(with_pip=False, symlinks=False)
self.run_with_capture(builder.create, self.env_dir)
self.assertFalse(os.path.islink(python))
self.assertTrue(os.path.exists(python))There was a problem hiding this comment.
Thanks for spotting this, I pushed coverage for the --copies path
claydugo
commented
Jun 5, 2026
Hmm, I could use guidance on getting the change detection pipeline passing without force push. I might have gotten it in a bad state using the Github UI |
brettcannon
commented
Jun 5, 2026
I don't know how to get is out of this wedged state. Mind closing this PR and opening a new one? |
claydugo
commented
Jun 5, 2026
Closing in favor of #150985 |
Summary
Fix
venvso re-running it in a directory with stale interpreter symlinksremoves the broken links before recreating them, and add a regression test
to ensure existing environments get their interpreter refreshed without
--clear.Issue number
#143768