summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-07-17 16:33:46 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-07-17 16:33:46 (GMT)
commit90db661b4335eaf7a3cb5e9a4524ae9707eeaf76 (patch)
treeb73b67deb7feab489b2f43d8cc43778e8ac8cb23 /Modules/main.c
parent11718620ef87268fae07ba0809fec63b9c6d15e3 (diff)
downloadcpython-90db661b4335eaf7a3cb5e9a4524ae9707eeaf76.zip
cpython-90db661b4335eaf7a3cb5e9a4524ae9707eeaf76.tar.gz
cpython-90db661b4335eaf7a3cb5e9a4524ae9707eeaf76.tar.bz2
Closes #15307: symlinks now work on OS X with framework Python builds. Patch by Ronald Oussoren.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 64bac6e..e86aa77 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -616,7 +616,29 @@ Py_Main(int argc, wchar_t **argv)
Py_SetProgramName(buffer);
/* buffer is now handed off - do not free */
} else {
+#ifdef WITH_NEXT_FRAMEWORK
+ char* pyvenv_launcher = getenv("__PYVENV_LAUNCHER__");
+
+ if (pyvenv_launcher && *pyvenv_launcher) {
+ /* Used by Mac/Tools/pythonw.c to forward
+ * the argv0 of the stub executable
+ */
+ wchar_t* wbuf = _Py_char2wchar(pyvenv_launcher, NULL);
+
+ if (wbuf == NULL) {
+ Py_FatalError("Cannot decode __PYVENV_LAUNCHER__");
+ }
+ Py_SetProgramName(wbuf);
+
+ /* Don't free wbuf, the argument to Py_SetProgramName
+ * must remain valid until the Py_Finalize is called.
+ */
+ } else {
+ Py_SetProgramName(argv[0]);
+ }
+#else
Py_SetProgramName(argv[0]);
+#endif
}
#else
Py_SetProgramName(argv[0]);