Skip to content

🐛 fix(create): replace stale venv interpreter - #3610

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
gaborbernat:fix/replace-stale-venv-interpreter
Nov 20, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
gaborbernat:fix/replace-stale-venv-interpreter

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

The environment recreation path could leave a copied POSIX interpreter at bin/python when rebuilding an existing environment with another Python version. The rebuilt environment then ran the old interpreter. Recreation now replaces copied interpreter aliases before the standard library creator runs. Fixes #3605.

Existing interpreter files

The cleanup path removes regular files for the selected interpreter's aliases as well as the symlinks and hard links it already removed. CPython 3.14 also creates 𝜋thon on UTF-8 filesystems; the cleanup includes that name when the selected interpreter matches those conditions.

Behavior changes

Recreating a copied POSIX environment refreshes its interpreter aliases. Other files in bin keep the existing cleanup behavior.

Report ANT-2026-HFVRTAWM.

CPython 3.14 creates a pi-named interpreter alias on UTF-8 filesystems.
Recreation now replaces that alias along with the selected interpreter's
usual names. Other runtimes keep unrelated files with the same name.

The test uses a separate file to replace an executable, then runs the
alias being checked. Unsupported copy-based creators are skipped.
@gaborbernat
gaborbernat merged commit da417bd into pypa:main Nov 20, 2026
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Venv creator retains a stale copied interpreter

1 participant