Author vstinner
Recipients ezio.melotti, flox, jnoller, pitrou, ronaldoussoren, schmir, tarek, vstinner
Date 2010-03-11.12:56:43
SpamBayes Score 1.03129e-12
Marked as misclassified No
Message-id <1268312205.94.0.103673536083.issue7774@psf.upfronthosting.co.za>
In-reply-to
Content
r78835 (trunk) fixes getpath and includes also a fix for sysconfig which should fix test_executable_with_cwd() of test_subprocess.

My fix on sysconfig is different than flox's patch: since I fixed getpath, sys.executable cannot be a directory name. At revision r78835, sys.executable can have 3 values:
 (a) absolute path to Python executable name (most common case)
 (b) empty string if argv[0] has been set to a non existent program name
 (c) absolute path to a different program if argv[0] has been set to a different program, with or without path (eg. "true" and "/bin/path")

(c) is the worst case: Python refuses to start. r78835 fixes the site module error for case (b).

There are different methods to get the real program name, but no one is portable. As flox wrote, we can "do a best effort to provide a valid sys.executable". Extract of stackoverflow link:

 * Mac OS X: _NSGetExecutablePath() (man 3 dyld)
 * Linux: readlink /proc/self/exe
 * Solaris: getexecname()
 * FreeBSD: sysctl CTL_KERN KERN_PROC KERN_PROC_PATHNAME -1
 * BSD with procfs: readlink /proc/curproc/file
 * Windows: GetModuleFileName() with hModule = NULL
History
Date User Action Args
2010-03-11 12:56:46vstinnersetrecipients: + vstinner, ronaldoussoren, pitrou, schmir, tarek, jnoller, ezio.melotti, flox
2010-03-11 12:56:45vstinnersetmessageid: <1268312205.94.0.103673536083.issue7774@psf.upfronthosting.co.za>
2010-03-11 12:56:44vstinnerlinkissue7774 messages
2010-03-11 12:56:43vstinnercreate