You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The search for pyvenv.cfg doesn't match PEP 405 #77483
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2018-04-17.21:48:27.965>labels= ['interpreter-core', 'type-bug', '3.7']
title="The search for pyvenv.cfg doesn't match PEP 405"updated_at=<Date2018-04-17.21:48:27.965>user='https://github.com/mattheww'
PEP-405 says that the pyvenv.cfg file is found as follows:
« a pyvenv.cfg file is found either adjacent to the Python executable or one directory above it (if the executable is a symlink, it is not dereferenced), »
But in cpython if the executable is a symlink, it _is_ dereferenced before searching for pyvenv.cfg .
I've checked this behaviour with Python 3.5, 3.6, and today's 3.7 tip.
Looking in 3.7's getpath.c, calculate_path_impl() calls, in order:
It looks like the symlink resolution happens near the end of calculate_argv0_path().
I think this means that the 'home=' line in pyvenv.cfg files generated by the 'venv' module is irrelevant (and seems likely to confuse anyone who might try to construct a Python environment by imitating a built venv).
Activity
mattheww commentedon Apr 17, 2018
PEP-405 says that the pyvenv.cfg file is found as follows:
« a pyvenv.cfg file is found either adjacent to the Python executable or one directory above it (if the executable is a symlink, it is not dereferenced), »
But in cpython if the executable is a symlink, it _is_ dereferenced before searching for pyvenv.cfg .
I've checked this behaviour with Python 3.5, 3.6, and today's 3.7 tip.
Looking in 3.7's getpath.c, calculate_path_impl() calls, in order:
It looks like the symlink resolution happens near the end of calculate_argv0_path().
I think this means that the 'home=' line in pyvenv.cfg files generated by the 'venv' module is irrelevant (and seems likely to confuse anyone who might try to construct a Python environment by imitating a built venv).
mattheww commentedon Sep 6, 2026
I think this was fixed by #29041 (for Python 3.11) and Python now behaves as PEP 405 said it should.