diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-23 00:13:28 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-23 00:13:28 (GMT) |
commit | 2158231433c19e1e8eec24d8d053da2a02256747 (patch) | |
tree | cb68923595417f6d946e71358e5afba21e9d6790 /Modules/getpath.c | |
parent | ff150f2921e554f61ac5452757bd39d881bf1a5f (diff) | |
download | cpython-2158231433c19e1e8eec24d8d053da2a02256747.zip cpython-2158231433c19e1e8eec24d8d053da2a02256747.tar.gz cpython-2158231433c19e1e8eec24d8d053da2a02256747.tar.bz2 |
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.
Diffstat (limited to 'Modules/getpath.c')
-rw-r--r-- | Modules/getpath.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c index 20030ce..0d4a485 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -285,13 +285,16 @@ search_for_prefix(wchar_t *argv0_path, wchar_t *home) joinpath(prefix, L"Modules/Setup"); if (isfile(prefix)) { /* Check VPATH to see if argv0_path is in the build directory. */ - vpath = L"" VPATH; - wcscpy(prefix, argv0_path); - joinpath(prefix, vpath); - joinpath(prefix, L"Lib"); - joinpath(prefix, LANDMARK); - if (ismodule(prefix)) - return -1; + vpath = _Py_char2wchar(VPATH, NULL); + if (vpath != NULL) { + wcscpy(prefix, argv0_path); + joinpath(prefix, vpath); + PyMem_Free(vpath); + joinpath(prefix, L"Lib"); + joinpath(prefix, LANDMARK); + if (ismodule(prefix)) + return -1; + } } /* Search from argv0_path, until root is found */ |