@@ -589,6 +589,15 @@ calculate_reduce_exec_prefix(PyCalculatePath *calculate, PyPathConfig *config)
589589static void
590590calculate_progpath (PyCalculatePath * calculate , PyPathConfig * config )
591591{
592+ #ifdef __APPLE__
593+ #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
594+ uint32_t nsexeclength = MAXPATHLEN ;
595+ #else
596+ unsigned long nsexeclength = MAXPATHLEN ;
597+ #endif
598+ char execpath [MAXPATHLEN + 1 ];
599+ #endif
600+
592601 /* If there is no slash in the argv0 path, then we have to
593602 * assume python is on the user's $PATH, since there's no
594603 * other way to find a directory to start the search from. If
@@ -597,15 +606,7 @@ calculate_progpath(PyCalculatePath *calculate, PyPathConfig *config)
597606 if (wcschr (calculate -> prog , SEP )) {
598607 wcsncpy (config -> progpath , calculate -> prog , MAXPATHLEN );
599608 }
600-
601609#ifdef __APPLE__
602- #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
603- uint32_t nsexeclength = MAXPATHLEN ;
604- #else
605- unsigned long nsexeclength = MAXPATHLEN ;
606- #endif
607- char execpath [MAXPATHLEN + 1 ];
608-
609610 /* On Mac OS X, if a script uses an interpreter of the form
610611 * "#!/opt/python2.3/bin/python", the kernel only passes "python"
611612 * as argv[0], which falls through to the $PATH search below.
0 commit comments