diff options
Diffstat (limited to 'plugins/pychrysalide/arch/processor.c')
-rw-r--r-- | plugins/pychrysalide/arch/processor.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c index c2ee530..3ac18fa 100644 --- a/plugins/pychrysalide/arch/processor.c +++ b/plugins/pychrysalide/arch/processor.c @@ -38,6 +38,7 @@ #include "instriter.h" #include "instruction.h" #include "vmpa.h" +#include "../access.h" #include "../helpers.h" @@ -489,20 +490,27 @@ PyTypeObject *get_python_arch_processor_type(void) * * ******************************************************************************/ -bool register_python_arch_processor(PyObject *module) +bool ensure_python_arch_processor_is_registered(void) { - PyTypeObject *py_arch_processor_type; /* Type Python 'BinContent' */ + PyTypeObject *type; /* Type Python 'ArchProcessor' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_arch_processor_type = get_python_arch_processor_type(); + type = get_python_arch_processor_type(); - dict = PyModule_GetDict(module); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.arch"); + + dict = PyModule_GetDict(module); - if (!register_class_for_pygobject(dict, G_TYPE_ARCH_PROCESSOR, py_arch_processor_type, &PyGObject_Type)) - return false; + if (!register_class_for_pygobject(dict, G_TYPE_ARCH_PROCESSOR, type, &PyGObject_Type)) + return false; - if (!define_python_arch_processor_constants(py_arch_processor_type)) - return false; + if (!define_python_arch_processor_constants(type)) + return false; + + } return true; |