summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/db/certs.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/db/certs.c')
-rw-r--r--plugins/pychrysalide/analysis/db/certs.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/plugins/pychrysalide/analysis/db/certs.c b/plugins/pychrysalide/analysis/db/certs.c
index e0358d1..385e277 100644
--- a/plugins/pychrysalide/analysis/db/certs.c
+++ b/plugins/pychrysalide/analysis/db/certs.c
@@ -33,6 +33,7 @@
#include <analysis/db/certs.h>
+#include "../../access.h"
#include "../../helpers.h"
@@ -307,21 +308,31 @@ PyTypeObject *get_python_certs_type(void)
* *
******************************************************************************/
-bool register_python_certs(PyObject *module)
+bool ensure_python_certs_is_registered(void)
{
- PyTypeObject *py_certs_type; /* Type Python pour 'certs' */
+ PyTypeObject *type; /* Type Python pour 'certs' */
+ PyObject *module; /* Module à recompléter */
int ret; /* Bilan d'un appel */
- py_certs_type = get_python_certs_type();
+ type = get_python_certs_type();
- py_certs_type->tp_new = PyType_GenericNew;
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ type->tp_new = PyType_GenericNew;
- if (PyType_Ready(py_certs_type) != 0)
- return false;
+ if (PyType_Ready(type) != 0)
+ return false;
- Py_INCREF(py_certs_type);
- ret = PyModule_AddObject(module, "certs", (PyObject *)py_certs_type);
+ module = get_access_to_python_module("pychrysalide.analysis.db");
- return (ret == 0);
+ Py_INCREF(type);
+ ret = PyModule_AddObject(module, "certs", (PyObject *)type);
+
+ if (ret != 0)
+ return false;
+
+ }
+
+ return true;
}