summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/contents/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/contents/file.c')
-rw-r--r--plugins/pychrysalide/analysis/contents/file.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/contents/file.c b/plugins/pychrysalide/analysis/contents/file.c
index b033611..a44263e 100644
--- a/plugins/pychrysalide/analysis/contents/file.c
+++ b/plugins/pychrysalide/analysis/contents/file.c
@@ -31,6 +31,7 @@
#include <analysis/contents/file.h>
+#include "../../access.h"
#include "../../helpers.h"
@@ -132,17 +133,24 @@ PyTypeObject *get_python_file_content_type(void)
* *
******************************************************************************/
-bool register_python_file_content(PyObject *module)
+bool ensure_python_file_content_is_registered(void)
{
- PyTypeObject *py_file_content_type; /* Type Python 'FileContent' */
+ PyTypeObject *type; /* Type Python 'FileContent' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_file_content_type = get_python_file_content_type();
+ type = get_python_file_content_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.analysis.contents");
- if (!register_class_for_pygobject(dict, G_TYPE_FILE_CONTENT, py_file_content_type, &PyGObject_Type))
- return false;
+ dict = PyModule_GetDict(module);
+
+ if (!register_class_for_pygobject(dict, G_TYPE_FILE_CONTENT, type, &PyGObject_Type))
+ return false;
+
+ }
return true;