summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-07-19 09:09:32 (GMT)
committerThomas Heller <theller@ctypes.org>2006-07-19 09:09:32 (GMT)
commit100a4e944b21e122bddbb1847cb0943c6b64ad12 (patch)
treec542856cafad2a4f7ffb88239c883b88366d4b40
parent112aad3630975da8a949291faaab5c578442e9d2 (diff)
downloadcpython-100a4e944b21e122bddbb1847cb0943c6b64ad12.zip
cpython-100a4e944b21e122bddbb1847cb0943c6b64ad12.tar.gz
cpython-100a4e944b21e122bddbb1847cb0943c6b64ad12.tar.bz2
Make sure the _ctypes extension can be compiled when WITH_THREAD is
not defined on Windows, even if that configuration is probably not supported at all.
-rw-r--r--Modules/_ctypes/callbacks.c2
-rw-r--r--Modules/_ctypes/callproc.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 55ba5f0..c091d88 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -348,7 +348,9 @@ void init_callbacks_in_module(PyObject *m)
static void LoadPython(void)
{
if (!Py_IsInitialized()) {
+#ifdef WITH_THREAD
PyEval_InitThreads();
+#endif
Py_Initialize();
}
}
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 0fe7d10..6342ece 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -818,7 +818,9 @@ GetComError(HRESULT errcode, GUID *riid, IUnknown *pIunk)
/* We absolutely have to release the GIL during COM method calls,
otherwise we may get a deadlock!
*/
+#ifdef WITH_THREAD
Py_BEGIN_ALLOW_THREADS
+#endif
hr = pIunk->lpVtbl->QueryInterface(pIunk, &IID_ISupportErrorInfo, (void **)&psei);
if (FAILED(hr))
@@ -842,7 +844,9 @@ GetComError(HRESULT errcode, GUID *riid, IUnknown *pIunk)
pei->lpVtbl->Release(pei);
failed:
+#ifdef WITH_THREAD
Py_END_ALLOW_THREADS
+#endif
progid = NULL;
ProgIDFromCLSID(&guid, &progid);