[Python-checkins] r66862 - in python/trunk: Misc/NEWS Modules/posixmodule.c
hirokazu.yamamoto
python-checkins at python.org
Thu Oct 9 12:00:31 CEST 2008
Author: hirokazu.yamamoto
Date: Thu Oct 9 12:00:30 2008
New Revision: 66862
Log:
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)
Modified:
python/trunk/Misc/NEWS
python/trunk/Modules/posixmodule.c
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Thu Oct 9 12:00:30 2008
@@ -12,6 +12,10 @@
Core and Builtins
-----------------
+- 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)
+
- Issue #4069: When set.remove(element) is used with a set element, the element
is temporarily replaced with an equivalent frozenset. But the eventual
KeyError would always report the empty frozenset([]) as the missing key. Now
Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c (original)
+++ python/trunk/Modules/posixmodule.c Thu Oct 9 12:00:30 2008
@@ -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)
More information about the Python-checkins
mailing list