Skip to content

馃悰 fix(create): skip blank and comment lines in pyvenv.cfg - #3232

Open
r3wretrhy wants to merge 1 commit into
pypa:mainfrom
r3wretrhy:fix-pyvenv-cfg-skip-blank
Open

馃悰 fix(create): skip blank and comment lines in pyvenv.cfg#3232
r3wretrhy wants to merge 1 commit into
pypa:mainfrom
r3wretrhy:fix-pyvenv-cfg-skip-blank

Conversation

@r3wretrhy

Copy link
Copy Markdown

PyEnvCfg._read_values used line.index("=") on every line of pyvenv.cfg. A blank line, a # comment, or a line without = therefore raised ValueError while refreshing an existing environment.

Skip those lines and keep the key = value entries. Quoted values are still unquoted the same way.

The added test fails on the unpatched tree and passes with the change.

Reading an existing pyvenv.cfg called line.index("=") on every line, so a
blank line, a comment or any line without a separator raised ValueError
while refreshing an environment. Skip those lines instead, matching how
CPython parses the same file.

Co-authored-by: Bernat Gabor <gaborjbernat@gmail.com>
Claude-Session: https://claude.ai/code/session_011VmD9PD4Vf9AFkFbwqvskx
@gaborbernat
gaborbernat force-pushed the fix-pyvenv-cfg-skip-blank branch from 8a5b8ec to 01fbfda Compare September 9, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants