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.

Author christian.heimes
Recipients christian.heimes
Date 2012-11-21.07:58:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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/', '/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/
+++ b/Lib/
@@ -484,7 +484,7 @@
         executable = os.environ['__PYVENV_LAUNCHER__']
         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:54christian.heimessetrecipients: + christian.heimes
2012-11-21 07:58:54christian.heimessetmessageid: <>
2012-11-21 07:58:54christian.heimeslinkissue16519 messages
2012-11-21 07:58:53christian.heimescreate