Skip to content

🐛 fix(create): contain venv include - #3664

Merged
gaborbernat merged 1 commit into
pypa:mainfrom
gaborbernat:fix/3628-contain-venv-include
Nov 20, 2026
Merged

gaborbernat merged 1 commit into
pypa:mainfrom
gaborbernat:fix/3628-contain-venv-include

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Venv.create() prepared executable and library directories before invoking stdlib venv, but omitted include. In a reused environment with a linked include, Python 3.11 could create an empty versioned directory at the link target; Python 3.14 rejected the link. The creator now prepares include with the same containment rule. Fixes #3628.

The omitted directory

#3429 added ensure_within() for stdlib venv output directories. Python 3.11's EnvBuilder.ensure_directories() creates a versioned child under include, which can follow an existing parent link. The new directory list includes include on POSIX and Include on Windows before stdlib creation begins.

Behavior changes

When reusing an environment with a linked include directory, the link is replaced by an in-environment directory. Its former target is left untouched. The same preparation runs for new environments and creates the include directory before stdlib venv starts.

Reported by oss-scanner: ANT-2026-SQMY7UXO.

@gaborbernat
gaborbernat force-pushed the fix/3628-contain-venv-include branch 4 times, most recently from 5971c92 to a2cd271 Compare November 20, 2026 09:10
pypa#3429 checked stdlib venv's executable and library directories before
calling EnvBuilder, but omitted include. On Python 3.11, a reused include
link lets EnvBuilder create a directory at its target. Check include with
the same directory rule before invoking stdlib venv.

Fixes pypa#3628
@gaborbernat
gaborbernat force-pushed the fix/3628-contain-venv-include branch from a2cd271 to b0839fb Compare November 20, 2026 10:45
@gaborbernat
gaborbernat marked this pull request as ready for review November 20, 2026 12:02
@gaborbernat
gaborbernat merged commit a91ff8b 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 follows linked include directory

1 participant