Skip to content

gh-143768: Replace a dangling interpreter symlink when creating a venv - #150985

Open
claydugo wants to merge 4 commits into
python:mainfrom
claydugo:gh-143768-venv-symlink-v2
Open

gh-143768: Replace a dangling interpreter symlink when creating a venv#150985
claydugo wants to merge 4 commits into
python:mainfrom
claydugo:gh-143768-venv-symlink-v2

Conversation

@claydugo

@claydugo claydugo commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

A dangling interpreter symlink in the target directory caused venv to crash with --copies and to silently leave the broken link in place with symlinks.
symlink_or_copy now unlinks a dangling destination symlink first, matching how a stale regular file is already replaced on re-run.

Supersedes #143770, which got stuck in a wedged change-detection state after a bad merge via the GitHub UI.

Comment thread Lib/test/test_venv.py Outdated
Comment thread Lib/test/test_venv.py Outdated
Comment thread Misc/NEWS.d/next/Library/2026-06-05-16-57-03.gh-issue-143768.RbLnkFx.rst Outdated
@brettcannon
brettcannon enabled auto-merge (squash) August 7, 2026 23:28
@brettcannon brettcannon self-assigned this Aug 7, 2026
@brettcannon
brettcannon disabled auto-merge August 7, 2026 23:29

@brettcannon brettcannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that there's no doc update about the semantic change. Otherwise LGTM!

@bedevere-app

bedevere-app Bot commented Aug 7, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@claydugo

claydugo commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Just pushed a doc update

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33972991 | 📁 Comparing dc59676 against main (8ed1479)

  🔍 Preview build  

2 files changed
± library/venv.html
± whatsnew/changelog.html

@brettcannon

Copy link
Copy Markdown
Member

Thanks for the review! Just pushed a doc update

If you're ready for another review then don't forget to follow the instructions from the bot about how to notify folks you're ready.

@claydugo

Copy link
Copy Markdown
Contributor Author

Oops, glazed right over that. Sorry. I have made the requested changes; please review again

@bedevere-app

bedevere-app Bot commented Aug 10, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@brettcannon: please review the changes made to this pull request.

@bedevere-app
bedevere-app Bot requested a review from brettcannon August 10, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants