/** @cond PRIVATE */
-SRD_PRIV PyObject *srd_logic_type = NULL;
-
/*
* When initialized, a reference to this module inside the Python interpreter
* lives here.
/** @cond PRIVATE */
PyMODINIT_FUNC PyInit_sigrokdecode(void)
{
- PyObject *mod, *Decoder_type, *logic_type;
+ PyObject *mod, *Decoder_type;
+ PyGILState_STATE gstate;
+
+ gstate = PyGILState_Ensure();
mod = PyModule_Create(&sigrokdecode_module);
if (!mod)
if (PyModule_AddObject(mod, "Decoder", Decoder_type) < 0)
goto err_out;
- logic_type = srd_logic_type_new();
- if (!logic_type)
- goto err_out;
- if (PyModule_AddObject(mod, "srd_logic", logic_type) < 0)
- goto err_out;
-
/* Expose output types as symbols in the sigrokdecode module */
if (PyModule_AddIntConstant(mod, "OUTPUT_ANN", SRD_OUTPUT_ANN) < 0)
goto err_out;
if (PyModule_AddIntConstant(mod, "SRD_CONF_SAMPLERATE", SRD_CONF_SAMPLERATE) < 0)
goto err_out;
- srd_logic_type = logic_type;
mod_sigrokdecode = mod;
+ PyGILState_Release(gstate);
+
return mod;
err_out:
Py_XDECREF(mod);
srd_exception_catch("Failed to initialize module");
+ PyGILState_Release(gstate);
return NULL;
}