From 06eecead03a7698ca7a1d15548e6bf35fab2dbfb Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sun, 21 Oct 2012 16:33:33 +0200 Subject: [PATCH] Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle. Patch by Atsuo Ishimoto. --- Misc/NEWS | 3 +++ Modules/posixmodule.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 91ebfacee7..0f66e8def7 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -59,6 +59,9 @@ Core and Builtins 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. Patch by Brent Tubbs. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 1089ae399b..0fe3963d18 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1390,7 +1390,7 @@ attributes_from_dir_w(LPCWSTR pszFile, BY_HANDLE_FILE_INFORMATION *info, ULONG * } /* Grab GetFinalPathNameByHandle dynamically from kernel32 */ -static int has_GetFinalPathNameByHandle = 0; +static int has_GetFinalPathNameByHandle = -1; static DWORD (CALLBACK *Py_GetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD, DWORD); static int @@ -1401,7 +1401,7 @@ check_GetFinalPathNameByHandle() DWORD); /* only recheck */ - if (!has_GetFinalPathNameByHandle) + if (-1 == has_GetFinalPathNameByHandle) { hKernel32 = GetModuleHandleW(L"KERNEL32"); *(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32, -- 2.50.1