diff options
Diffstat (limited to 'plugins/pychrysalide/analysis/block.c')
-rw-r--r-- | plugins/pychrysalide/analysis/block.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/plugins/pychrysalide/analysis/block.c b/plugins/pychrysalide/analysis/block.c index e646ba8..010efd4 100644 --- a/plugins/pychrysalide/analysis/block.c +++ b/plugins/pychrysalide/analysis/block.c @@ -31,6 +31,7 @@ #include <analysis/block.h> +#include "../access.h" #include "../helpers.h" @@ -216,11 +217,9 @@ PyTypeObject *get_python_instr_block_type(void) return &py_instr_block_type; } - - /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : - * * * * Description : Prend en charge l'objet 'pychrysalide.analysis.InstrBlock'. * * * @@ -230,22 +229,25 @@ PyTypeObject *get_python_instr_block_type(void) * * ******************************************************************************/ -bool register_python_instr_block(PyObject *module) +bool ensure_python_instr_block_is_registered(void) { -#if 0 - PyTypeObject *py_instr_block_type; /* Type Python 'InstrBlock' */ + PyTypeObject *type; /* Type Python 'InstrBlock' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_instr_block_type = get_python_instr_block_type(); + type = get_python_instr_block_type(); - dict = PyModule_GetDict(module); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis"); - if (!register_class_for_pygobject(dict, G_TYPE_INSTR_BLOCK, py_instr_block_type, &PyGObject_Type)) - return false; + dict = PyModule_GetDict(module); + + if (!register_class_for_pygobject(dict, G_TYPE_CODE_BLOCK, type, &PyGObject_Type)) + return false; + + } - if (!py_instructions_block_define_constants(py_instr_block_type)) - return false; -#endif return true; } |