diff options
author | Bert Vermeulen <bert@biot.com> | 2013-11-18 10:44:28 +0100 |
---|---|---|
committer | Bert Vermeulen <bert@biot.com> | 2013-11-18 10:44:28 +0100 |
commit | aac68131f8ab9aa6dc1f1392a4f9a131a1c54d36 (patch) | |
tree | 1c9a804885af1f8ea94e9239c84dd6fd50324e6e /decoder.c | |
parent | 22c9bc2a4e958fccf498f4480965ec03884bc058 (diff) | |
download | libsigrokdecode-aac68131f8ab9aa6dc1f1392a4f9a131a1c54d36.tar.gz libsigrokdecode-aac68131f8ab9aa6dc1f1392a4f9a131a1c54d36.zip |
Don't try to load an already-loaded module
Python silently uses the existing module anyway, but the library
was counting it as an extra module. This was exposed by a test
case in the test suite.
Diffstat (limited to 'decoder.c')
-rw-r--r-- | decoder.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -260,6 +260,11 @@ SRD_API int srd_decoder_load(const char *module_name) if (!module_name) return SRD_ERR_ARG; + if (PyDict_GetItemString(PyImport_GetModuleDict(), module_name)) { + /* Module was already imported. */ + return SRD_OK; + } + srd_dbg("Loading protocol decoder '%s'.", module_name); py_basedec = py_method = py_attr = NULL; |