[Python-checkins] r85800 - python/branches/py3k/Modules/getpath.c
victor.stinner
python-checkins at python.org
Sat Oct 23 02:13:28 CEST 2010
Author: victor.stinner
Date: Sat Oct 23 02:13:28 2010
New Revision: 85800
Log:
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.
Modified:
python/branches/py3k/Modules/getpath.c
Modified: python/branches/py3k/Modules/getpath.c
==============================================================================
--- python/branches/py3k/Modules/getpath.c (original)
+++ python/branches/py3k/Modules/getpath.c Sat Oct 23 02:13:28 2010
@@ -285,13 +285,16 @@
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 */
More information about the Python-checkins
mailing list