diff options
Diffstat (limited to 'plugins/pychrysalide/analysis/types/template.c')
-rw-r--r-- | plugins/pychrysalide/analysis/types/template.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/plugins/pychrysalide/analysis/types/template.c b/plugins/pychrysalide/analysis/types/template.c index b8b13fb..cd2fa52 100644 --- a/plugins/pychrysalide/analysis/types/template.c +++ b/plugins/pychrysalide/analysis/types/template.c @@ -34,6 +34,7 @@ #include "../type.h" +#include "../../access.h" #include "../../helpers.h" @@ -293,18 +294,27 @@ PyTypeObject *get_python_template_type_type(void) * * ******************************************************************************/ -bool register_python_template_type(PyObject *module) +bool ensure_python_template_type_is_registered(void) { - PyTypeObject *py_template_type_type; /* Type Python 'TemplateType' */ + PyTypeObject *type; /* Type Python 'TemplateType' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_template_type_type = get_python_template_type_type(); + type = get_python_template_type_type(); - dict = PyModule_GetDict(module); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis.types"); + + dict = PyModule_GetDict(module); + + if (!ensure_python_data_type_is_registered()) + return false; - if (!register_class_for_pygobject(dict, G_TYPE_TEMPLATE_TYPE, - py_template_type_type, get_python_data_type_type())) - return false; + if (!register_class_for_pygobject(dict, G_TYPE_TEMPLATE_TYPE, type, get_python_data_type_type())) + return false; + + } return true; |