This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: The search for pyvenv.cfg doesn't match PEP 405
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: mattheww
Priority: normal Keywords:

Created on 2018-04-17 21:48 by mattheww, last changed 2022-04-11 14:58 by admin.

Messages (1)
msg315424 - (view) Author: Matthew Woodcraft (mattheww) Date: 2018-04-17 21:48
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:

   calculate_program_full_path()
   calculate_argv0_path()
   calculate_read_pyenv()

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).
History
Date User Action Args
2022-04-11 14:58:59adminsetgithub: 77483
2018-04-17 21:48:27matthewwcreate