diff options
Diffstat (limited to 'plugins/pychrysalide/arch/operand.c')
-rw-r--r-- | plugins/pychrysalide/arch/operand.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/pychrysalide/arch/operand.c b/plugins/pychrysalide/arch/operand.c index 427f92b..e464eac 100644 --- a/plugins/pychrysalide/arch/operand.c +++ b/plugins/pychrysalide/arch/operand.c @@ -31,6 +31,7 @@ #include <arch/operand.h> +#include "../access.h" #include "../helpers.h" @@ -90,19 +91,26 @@ PyTypeObject *get_python_arch_operand_type(void) * * ******************************************************************************/ -bool register_python_arch_operand(PyObject *module) +bool ensure_python_arch_operand_is_registered(void) { - PyTypeObject *py_arch_operand_type; /* Type Python 'BinContent' */ + PyTypeObject *type; /* Type Python 'ArchOperand' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_arch_operand_type = get_python_arch_operand_type(); + type = get_python_arch_operand_type(); - APPLY_ABSTRACT_FLAG(py_arch_operand_type); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + APPLY_ABSTRACT_FLAG(type); - dict = PyModule_GetDict(module); + module = get_access_to_python_module("pychrysalide.arch"); - if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, py_arch_operand_type, &PyGObject_Type)) - return false; + dict = PyModule_GetDict(module); + + if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, type, &PyGObject_Type)) + return false; + + } return true; |