[New-bugs-announce] [issue10835] sys.executable default and altinstall

Allan McRae report at bugs.python.org
Wed Jan 5 13:51:34 CET 2011


New submission from Allan McRae <allan at archlinux.org>:

when sys.executable is run with a modified argv[0] such as:

> sh -c "exec -a '' /usr/bin/python2.7 -c 'import sys; print(sys.executable)'"

it returns some a hardcoded value.   In this case, it returns /usr/bin/python.   This value is likely wrong when python is installed with "make altinstall".

A possible solution is to modify the "progname" variable in Python/pythonrun.c to include the version in it so that the hardcoded return value is the most version specific binary.  I.e.

static char *progname = "python2.7";

----------
components: Interpreter Core
messages: 125420
nosy: allan
priority: normal
severity: normal
status: open
title: sys.executable default and altinstall
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10835>
_______________________________________


More information about the New-bugs-announce mailing list