]> sigrok.org Git - libsigrokdecode.git/blobdiff - srd.c
Fix a unit test.
[libsigrokdecode.git] / srd.c
diff --git a/srd.c b/srd.c
index efd1c8ef4275f82840035e2171a5b5ff5710f1ed..fbdbdab888b1bb72a6fe32f57a00e4eaa62496da 100644 (file)
--- a/srd.c
+++ b/srd.c
@@ -271,7 +271,8 @@ SRD_API int srd_exit(void)
         * Acquire the GIL, otherwise Py_Finalize() might have issues.
         * Ignore the return value, we don't need it here.
         */
         * Acquire the GIL, otherwise Py_Finalize() might have issues.
         * Ignore the return value, we don't need it here.
         */
-       (void)PyGILState_Ensure();
+       if (Py_IsInitialized())
+               (void)PyGILState_Ensure();
 
        /* Py_Finalize() returns void, any finalization errors are ignored. */
        Py_Finalize();
 
        /* Py_Finalize() returns void, any finalization errors are ignored. */
        Py_Finalize();