Message176043
While I was testing #16499 I found a small bug in the venv code of the site module. The code in site.venv() doesn't use abspath() to sanitize the path to executable_dir. This leads to wrong behavior when a venv is created in the root of a hg checkout and the non-venv interpreter is called with a relative path:
(venv) heimes@hamiller:~/dev/python/cpython/venv$ ../python -c "import sys; print(sys.path)"
['', '/usr/local/lib/python34.zip', '/home/heimes/dev/python/cpython/Lib', '/home/heimes/dev/python/cpython/Lib/plat-linux', '/home/heimes/dev/python/cpython/build/lib.linux-x86_64-3.4-pydebug', '/home/heimes/dev/python/cpython/venv/lib/python3.4/site-packages']
The fix is simple, straight forward and totally harmless:
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -484,7 +484,7 @@
executable = os.environ['__PYVENV_LAUNCHER__']
else:
executable = sys.executable
- executable_dir, executable_name = os.path.split(executable)
+ executable_dir, executable_name = os.path.split(os.path.abspath(executable))
site_prefix = os.path.dirname(executable_dir)
sys._home = None
if sys.platform == 'win32': |
|
Date |
User |
Action |
Args |
2012-11-21 07:58:54 | christian.heimes | set | recipients:
+ christian.heimes |
2012-11-21 07:58:54 | christian.heimes | set | messageid: <1353484734.27.0.00447607755708.issue16519@psf.upfronthosting.co.za> |
2012-11-21 07:58:54 | christian.heimes | link | issue16519 messages |
2012-11-21 07:58:53 | christian.heimes | create | |
|