X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=srd.c;fp=srd.c;h=fbdbdab888b1bb72a6fe32f57a00e4eaa62496da;hp=efd1c8ef4275f82840035e2171a5b5ff5710f1ed;hb=2071c4d3d8503b8ae9ccd623cec1163ec6732a91;hpb=45a5088085c07c862549ad820d752a46ef0e0c76 diff --git a/srd.c b/srd.c index efd1c8e..fbdbdab 100644 --- 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. */ - (void)PyGILState_Ensure(); + if (Py_IsInitialized()) + (void)PyGILState_Ensure(); /* Py_Finalize() returns void, any finalization errors are ignored. */ Py_Finalize();