Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle.

Patch by Atsuo Ishimoto.
This commit is contained in:
Antoine Pitrou 2012-10-21 16:33:33 +02:00
parent d3a3e640b6
commit 06eecead03
2 changed files with 5 additions and 2 deletions

View File

@ -59,6 +59,9 @@ Core and Builtins
Library Library
------- -------
- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle.
Patch by Atsuo Ishimoto.
- Issue #16220: wsgiref now always calls close() on an iterable response. - Issue #16220: wsgiref now always calls close() on an iterable response.
Patch by Brent Tubbs. Patch by Brent Tubbs.

View File

@ -1390,7 +1390,7 @@ attributes_from_dir_w(LPCWSTR pszFile, BY_HANDLE_FILE_INFORMATION *info, ULONG *
} }
/* Grab GetFinalPathNameByHandle dynamically from kernel32 */ /* Grab GetFinalPathNameByHandle dynamically from kernel32 */
static int has_GetFinalPathNameByHandle = 0; static int has_GetFinalPathNameByHandle = -1;
static DWORD (CALLBACK *Py_GetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD, static DWORD (CALLBACK *Py_GetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD,
DWORD); DWORD);
static int static int
@ -1401,7 +1401,7 @@ check_GetFinalPathNameByHandle()
DWORD); DWORD);
/* only recheck */ /* only recheck */
if (!has_GetFinalPathNameByHandle) if (-1 == has_GetFinalPathNameByHandle)
{ {
hKernel32 = GetModuleHandleW(L"KERNEL32"); hKernel32 = GetModuleHandleW(L"KERNEL32");
*(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32, *(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32,