bpo-33895: Relase GIL while calling functions that acquire Windows lo… · python/cpython@4860f01

@@ -984,10 +984,12 @@ winreg_DeleteKeyEx_impl(PyObject *module, HKEY key,

984984985985

/* Only available on 64bit platforms, so we must load it

986986

dynamically. */

987+

Py_BEGIN_ALLOW_THREADS

987988

hMod = GetModuleHandleW(L"advapi32.dll");

988989

if (hMod)

989990

pfn = (RDKEFunc)GetProcAddress(hMod,

990991

"RegDeleteKeyExW");

992+

Py_END_ALLOW_THREADS

991993

if (!pfn) {

992994

PyErr_SetString(PyExc_NotImplementedError,

993995

"not implemented on this platform");

@@ -1714,10 +1716,12 @@ winreg_DisableReflectionKey_impl(PyObject *module, HKEY key)

1714171617151717

/* Only available on 64bit platforms, so we must load it

17161718

dynamically.*/

1719+

Py_BEGIN_ALLOW_THREADS

17171720

hMod = GetModuleHandleW(L"advapi32.dll");

17181721

if (hMod)

17191722

pfn = (RDRKFunc)GetProcAddress(hMod,

17201723

"RegDisableReflectionKey");

1724+

Py_END_ALLOW_THREADS

17211725

if (!pfn) {

17221726

PyErr_SetString(PyExc_NotImplementedError,

17231727

"not implemented on this platform");

@@ -1757,10 +1761,12 @@ winreg_EnableReflectionKey_impl(PyObject *module, HKEY key)

1757176117581762

/* Only available on 64bit platforms, so we must load it

17591763

dynamically.*/

1764+

Py_BEGIN_ALLOW_THREADS

17601765

hMod = GetModuleHandleW(L"advapi32.dll");

17611766

if (hMod)

17621767

pfn = (RERKFunc)GetProcAddress(hMod,

17631768

"RegEnableReflectionKey");

1769+

Py_END_ALLOW_THREADS

17641770

if (!pfn) {

17651771

PyErr_SetString(PyExc_NotImplementedError,

17661772

"not implemented on this platform");

@@ -1799,10 +1805,12 @@ winreg_QueryReflectionKey_impl(PyObject *module, HKEY key)

1799180518001806

/* Only available on 64bit platforms, so we must load it

18011807

dynamically.*/

1808+

Py_BEGIN_ALLOW_THREADS

18021809

hMod = GetModuleHandleW(L"advapi32.dll");

18031810

if (hMod)

18041811

pfn = (RQRKFunc)GetProcAddress(hMod,

18051812

"RegQueryReflectionKey");

1813+

Py_END_ALLOW_THREADS

18061814

if (!pfn) {

18071815

PyErr_SetString(PyExc_NotImplementedError,

18081816

"not implemented on this platform");