summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/arch/instruction.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/arch/instruction.c')
-rw-r--r--plugins/pychrysalide/arch/instruction.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/plugins/pychrysalide/arch/instruction.c b/plugins/pychrysalide/arch/instruction.c
index d659c87..df5bc15 100644
--- a/plugins/pychrysalide/arch/instruction.c
+++ b/plugins/pychrysalide/arch/instruction.c
@@ -33,6 +33,7 @@
#include "vmpa.h"
+#include "../access.h"
#include "../helpers.h"
#include "../glibext/linegen.h"
@@ -498,23 +499,30 @@ PyTypeObject *get_python_arch_instruction_type(void)
* *
******************************************************************************/
-bool register_python_arch_instruction(PyObject *module)
+bool ensure_python_arch_instruction_is_registered(void)
{
- PyTypeObject *py_arch_instruction_type; /* Type Python 'ArchInstruc...'*/
+ PyTypeObject *type; /* Type Python 'ArchInstruc...'*/
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- PyTypeObject *py_line_generator_type; /* Type Python 'LineGenerator' */
- py_arch_instruction_type = get_python_arch_instruction_type();
+ type = get_python_arch_instruction_type();
- APPLY_ABSTRACT_FLAG(py_arch_instruction_type);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ APPLY_ABSTRACT_FLAG(type);
+
+ module = get_access_to_python_module("pychrysalide.arch");
- dict = PyModule_GetDict(module);
+ dict = PyModule_GetDict(module);
- py_line_generator_type = get_python_line_generator_type();
+ if (!ensure_python_line_generator_is_registered())
+ return false;
- if (!_register_class_for_pygobject(dict, G_TYPE_ARCH_INSTRUCTION, py_arch_instruction_type,
- &PyGObject_Type, py_line_generator_type, NULL))
- return false;
+ if (!_register_class_for_pygobject(dict, G_TYPE_ARCH_INSTRUCTION, type,
+ &PyGObject_Type, get_python_line_generator_type(), NULL))
+ return false;
+
+ }
return true;