On windows, os.chdir given unicode was not working if GetCurrentDirectoryW
returned a path longer than MAX_PATH. (But It's doubtful this code path is
really executed because I cannot move to such directory on win2k)
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 79c3a44..6e4925b 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -726,11 +726,14 @@
if (!result)
return FALSE;
if (result > MAX_PATH+1) {
- new_path = malloc(result);
+ new_path = malloc(result * sizeof(wchar_t));
if (!new_path) {
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
+ result = GetCurrentDirectoryW(result, new_path);
+ if (!result)
+ return FALSE;
}
if (wcsncmp(new_path, L"\\\\", 2) == 0 ||
wcsncmp(new_path, L"//", 2) == 0)