diff options
Diffstat (limited to 'plugins/pychrysalide/glibext/linegen.c')
-rw-r--r-- | plugins/pychrysalide/glibext/linegen.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/pychrysalide/glibext/linegen.c b/plugins/pychrysalide/glibext/linegen.c index 8368548..7b93f7e 100644 --- a/plugins/pychrysalide/glibext/linegen.c +++ b/plugins/pychrysalide/glibext/linegen.c @@ -32,6 +32,7 @@ #include <glibext/linegen.h> +#include "../access.h" #include "../helpers.h" #include "../analysis/content.h" #include "../arch/vmpa.h" @@ -393,15 +394,22 @@ PyTypeObject *get_python_line_generator_type(void) * * ******************************************************************************/ -bool register_python_line_generator(PyObject *module) +bool ensure_python_line_generator_is_registered(void) { - PyTypeObject *py_line_generator_type; /* Type Python 'LineGenerator' */ + PyTypeObject *type; /* Type Python 'LineGenerator' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_line_generator_type = get_python_line_generator_type(); + type = get_python_line_generator_type(); - dict = PyModule_GetDict(module); - pyg_register_interface(dict, "LineGenerator", G_TYPE_LINE_GENERATOR, py_line_generator_type); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.glibext"); + + dict = PyModule_GetDict(module); + pyg_register_interface(dict, "LineGenerator", G_TYPE_LINE_GENERATOR, type); + + } return true; |