Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06eecea

Browse files
committed
Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle.
Patch by Atsuo Ishimoto.
1 parent d3a3e64 commit 06eecea

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Core and Builtins
5959
Library
6060
-------
6161

62+
- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle.
63+
Patch by Atsuo Ishimoto.
64+
6265
- Issue #16220: wsgiref now always calls close() on an iterable response.
6366
Patch by Brent Tubbs.
6467

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ attributes_from_dir_w(LPCWSTR pszFile, BY_HANDLE_FILE_INFORMATION *info, ULONG *
13901390
}
13911391

13921392
/* Grab GetFinalPathNameByHandle dynamically from kernel32 */
1393-
static int has_GetFinalPathNameByHandle = 0;
1393+
static int has_GetFinalPathNameByHandle = -1;
13941394
static DWORD (CALLBACK *Py_GetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD,
13951395
DWORD);
13961396
static int
@@ -1401,7 +1401,7 @@ check_GetFinalPathNameByHandle()
14011401
DWORD);
14021402

14031403
/* only recheck */
1404-
if (!has_GetFinalPathNameByHandle)
1404+
if (-1 == has_GetFinalPathNameByHandle)
14051405
{
14061406
hKernel32 = GetModuleHandleW(L"KERNEL32");
14071407
*(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32,

0 commit comments

Comments
 (0)