Kaydet (Commit) 21582314 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #6011: getpath: decode VPATH env var from the locale encoding

Instead of casting it to wchar_t* without conversion. It fixes a bug if Python
is compiled a non-ascii directory, different than the source code directory,
with C locale.
üst ff150f29
...@@ -285,13 +285,16 @@ search_for_prefix(wchar_t *argv0_path, wchar_t *home) ...@@ -285,13 +285,16 @@ search_for_prefix(wchar_t *argv0_path, wchar_t *home)
joinpath(prefix, L"Modules/Setup"); joinpath(prefix, L"Modules/Setup");
if (isfile(prefix)) { if (isfile(prefix)) {
/* Check VPATH to see if argv0_path is in the build directory. */ /* Check VPATH to see if argv0_path is in the build directory. */
vpath = L"" VPATH; vpath = _Py_char2wchar(VPATH, NULL);
wcscpy(prefix, argv0_path); if (vpath != NULL) {
joinpath(prefix, vpath); wcscpy(prefix, argv0_path);
joinpath(prefix, L"Lib"); joinpath(prefix, vpath);
joinpath(prefix, LANDMARK); PyMem_Free(vpath);
if (ismodule(prefix)) joinpath(prefix, L"Lib");
return -1; joinpath(prefix, LANDMARK);
if (ismodule(prefix))
return -1;
}
} }
/* Search from argv0_path, until root is found */ /* Search from argv0_path, until root is found */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment