]> granicus.if.org Git - python/commitdiff
Make sure the _ctypes extension can be compiled when WITH_THREAD is
authorThomas Heller <theller@ctypes.org>
Wed, 19 Jul 2006 09:09:32 +0000 (09:09 +0000)
committerThomas Heller <theller@ctypes.org>
Wed, 19 Jul 2006 09:09:32 +0000 (09:09 +0000)
not defined on Windows, even if that configuration is probably not
supported at all.

Modules/_ctypes/callbacks.c
Modules/_ctypes/callproc.c

index 55ba5f0c0b3059220d3441848e94b7128ac84cb3..c091d88364a40a408340cbc93ed0cb7a0998b663 100644 (file)
@@ -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();
        }
 }
index 0fe7d103ffc10f5b8ba97e32ea1d97d4ec9f4e28..6342ece10d745b711b4a0075e37e87c8744e7954 100644 (file)
@@ -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);