Skip to content

🐛 fix(create): reject oversized CPython config - #3613

Merged
gaborbernat merged 3 commits into
pypa:mainfrom
gaborbernat:fix/reject-oversized-pyvenv-config
Nov 20, 2026
Merged

gaborbernat merged 3 commits into
pypa:mainfrom
gaborbernat:fix/reject-oversized-pyvenv-config

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

The configuration writer accepted a pyvenv.cfg large enough that CPython 3.11+ could not read it on startup. It now checks the encoded size before replacing the file. Fixes #3601.

CPython size limit

The updated write path rejects a CPython 3.11+ configuration of 32 KiB or more with ValueError. The check uses encoded bytes because non-ASCII prompt text can use more than one byte per character. CPython 3.9 and 3.10 can start with a 33 KiB config, so they retain the previous behavior.

Creation fails before replacing an existing config if the limit is reached. Other Python implementations keep their existing write behavior.

Report ANT-2026-QQPFLYHX.

CPython 3.9 and 3.10 can start with a 33 KiB pyvenv.cfg. Keep those
versions working while rejecting files above the limit on newer CPython.
@gaborbernat
gaborbernat merged commit f5b9968 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.

Oversized prompt creates an unusable CPython environment

1 participant