summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/types/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/types/expr.c')
-rw-r--r--plugins/pychrysalide/analysis/types/expr.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/types/expr.c b/plugins/pychrysalide/analysis/types/expr.c
index 2988af9..619b2da 100644
--- a/plugins/pychrysalide/analysis/types/expr.c
+++ b/plugins/pychrysalide/analysis/types/expr.c
@@ -33,6 +33,7 @@
#include "../type.h"
+#include "../../access.h"
#include "../../helpers.h"
@@ -168,17 +169,27 @@ PyTypeObject *get_python_expr_type_type(void)
* *
******************************************************************************/
-bool register_python_expr_type(PyObject *module)
+bool ensure_python_expr_type_is_registered(void)
{
- PyTypeObject *py_expr_type_type; /* Type Python 'ExprType' */
+ PyTypeObject *type; /* Type Python 'ExprType' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_expr_type_type = get_python_expr_type_type();
+ type = get_python_expr_type_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.analysis.types");
- if (!register_class_for_pygobject(dict, G_TYPE_EXPR_TYPE, py_expr_type_type, get_python_data_type_type()))
- return false;
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_data_type_is_registered())
+ return false;
+
+ if (!register_class_for_pygobject(dict, G_TYPE_EXPR_TYPE, type, get_python_data_type_type()))
+ return false;
+
+ }
return true;