Eryk Sun <eryk...@gmail.com> added the comment:

> So I'm +1 on fixing this by calling realpath.

In POSIX, calculate_path() in Modules/getpath.c calls calculate_argv0_path() 
before it calls calculate_read_pyenv(), and calculate_argv0_path() in turn 
calls resolve_symlinks(&calculate->argv0_path). Thus "pyvenv.cfg" isn't found 
and isn't used to find the standard library in POSIX when a virtual environment 
uses symlinks. Later on, "pyvenv.cfg" gets read by the site module, if 
importing the latter isn't skipped via -S. The site module sets sys._home to 
the `home` value, but sys._home only appears to be used by sysconfig when 
running from the build directory.

In Windows, calculate_path() in PC/getpathp.c could get the final (real) path 
for argv0_path before calling calculate_pyvenv_file(). Then, just like in 
POSIX, the environment's "pyvenv.cfg" file won't be found and won't be used to 
find the standard library when a virtual environment uses symlinks.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42013>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to