Commit 10a018c2 authored by Hirokazu Yamamoto's avatar Hirokazu Yamamoto

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)
parent fc72de7b
...@@ -12,6 +12,10 @@ What's New in Python 2.7 alpha 1 ...@@ -12,6 +12,10 @@ What's New in Python 2.7 alpha 1
Core and Builtins 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 - Issue #4069: When set.remove(element) is used with a set element, the element
is temporarily replaced with an equivalent frozenset. But the eventual is temporarily replaced with an equivalent frozenset. But the eventual
KeyError would always report the empty frozenset([]) as the missing key. Now KeyError would always report the empty frozenset([]) as the missing key. Now
......
...@@ -726,11 +726,14 @@ win32_wchdir(LPCWSTR path) ...@@ -726,11 +726,14 @@ win32_wchdir(LPCWSTR path)
if (!result) if (!result)
return FALSE; return FALSE;
if (result > MAX_PATH+1) { if (result > MAX_PATH+1) {
new_path = malloc(result); new_path = malloc(result * sizeof(wchar_t));
if (!new_path) { if (!new_path) {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
} }
result = GetCurrentDirectoryW(result, new_path);
if (!result)
return FALSE;
} }
if (wcsncmp(new_path, L"\\\\", 2) == 0 || if (wcsncmp(new_path, L"\\\\", 2) == 0 ||
wcsncmp(new_path, L"//", 2) == 0) wcsncmp(new_path, L"//", 2) == 0)
......
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