Issue #7774: Set sys.executable to an empty string if argv[0] has been

set to an non existent program name and Python is unable to retrieve the real
program name.

Fix also sysconfig: if sys.executable is an empty string, use the current
working directory.
This commit is contained in:
Victor Stinner 2010-03-11 12:34:39 +00:00
parent 637637021a
commit 4a7e0c858c
4 changed files with 22 additions and 2 deletions

View file

@ -441,7 +441,7 @@ calculate_path(void)
}
else
progpath[0] = '\0';
if (progpath[0] != SEP)
if (progpath[0] != SEP && progpath[0] != '\0')
absolutize(progpath);
strncpy(argv0_path, progpath, MAXPATHLEN);
argv0_path[MAXPATHLEN] = '\0';