Skip to content

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

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
r3wretrhy:fix-pyvenv-cfg-skip-blank
Sep 15, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
r3wretrhy:fix-pyvenv-cfg-skip-blank

Conversation

@r3wretrhy

@r3wretrhy r3wretrhy commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

PyEnvCfg._read_values called line.index("=") on each line of pyvenv.cfg, so a blank line, a # comment or a line
without = raised ValueError when virtualenv read the file of an existing environment.

The parser now skips those lines. test_pyenv_cfg_from_folder_skips_non_entries in tests/unit/create/test_creator.py
covers each case and fails on main.

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
@gaborbernat
gaborbernat enabled auto-merge (squash) September 15, 2026 22:06
@gaborbernat
gaborbernat force-pushed the fix-pyvenv-cfg-skip-blank branch from 78dd1c6 to 701a48c Compare September 15, 2026 22:08
@gaborbernat
gaborbernat merged commit b5bd520 into pypa:main Sep 15, 2026
59 checks passed
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