mirror of https://github.com/python/cpython.git
Oops, fix my previous commit (r85583) on calculate_path()
path value may be changed, so keep a copy in a new variable.
This commit is contained in:
parent
dc4b2a712f
commit
61aad57dc9
|
@ -407,6 +407,7 @@ calculate_path(void)
|
||||||
wchar_t rtpypath[MAXPATHLEN+1];
|
wchar_t rtpypath[MAXPATHLEN+1];
|
||||||
wchar_t *home = Py_GetPythonHome();
|
wchar_t *home = Py_GetPythonHome();
|
||||||
char *_path = getenv("PATH");
|
char *_path = getenv("PATH");
|
||||||
|
wchar_t *path_buffer = NULL;
|
||||||
wchar_t *path = NULL;
|
wchar_t *path = NULL;
|
||||||
wchar_t *prog = Py_GetProgramName();
|
wchar_t *prog = Py_GetProgramName();
|
||||||
wchar_t argv0_path[MAXPATHLEN+1];
|
wchar_t argv0_path[MAXPATHLEN+1];
|
||||||
|
@ -428,8 +429,10 @@ calculate_path(void)
|
||||||
char execpath[MAXPATHLEN+1];
|
char execpath[MAXPATHLEN+1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_path)
|
if (_path) {
|
||||||
path = _Py_char2wchar(_path, NULL);
|
path_buffer = _Py_char2wchar(_path, NULL);
|
||||||
|
path = path_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
/* If there is no slash in the argv0 path, then we have to
|
/* If there is no slash in the argv0 path, then we have to
|
||||||
* assume python is on the user's $PATH, since there's no
|
* assume python is on the user's $PATH, since there's no
|
||||||
|
@ -484,8 +487,8 @@ calculate_path(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
progpath[0] = '\0';
|
progpath[0] = '\0';
|
||||||
if (path != NULL)
|
if (path_buffer != NULL)
|
||||||
PyMem_Free(path);
|
PyMem_Free(path_buffer);
|
||||||
if (progpath[0] != SEP && progpath[0] != '\0')
|
if (progpath[0] != SEP && progpath[0] != '\0')
|
||||||
absolutize(progpath);
|
absolutize(progpath);
|
||||||
wcsncpy(argv0_path, progpath, MAXPATHLEN);
|
wcsncpy(argv0_path, progpath, MAXPATHLEN);
|
||||||
|
|
Loading…
Reference in New Issue