diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2017-07-06 08:23:34 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2017-07-06 11:25:24 +0200 |
commit | 2071c4d3d8503b8ae9ccd623cec1163ec6732a91 (patch) | |
tree | ea4eb853cf55723d06888f86fd7c70cd7776dc43 /srd.c | |
parent | 45a5088085c07c862549ad820d752a46ef0e0c76 (diff) | |
download | libsigrokdecode-2071c4d3d8503b8ae9ccd623cec1163ec6732a91.tar.gz libsigrokdecode-2071c4d3d8503b8ae9ccd623cec1163ec6732a91.zip |
Fix a unit test.
Only try to acquire the GIL if the Python interpreter is actually
initialized, otherwise there'll be a segfault.
Diffstat (limited to 'srd.c')
-rw-r--r-- | srd.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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(); |