summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/variable.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
commitfb315963527f6412273829f09513325e446eb6c9 (patch)
tree361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/analysis/variable.c
parent36945bffa2ca648b58c99905ebf9b1b536a9188a (diff)
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/variable.c')
-rw-r--r--plugins/pychrysalide/analysis/variable.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/pychrysalide/analysis/variable.c b/plugins/pychrysalide/analysis/variable.c
index 268e3c9..030b26f 100644
--- a/plugins/pychrysalide/analysis/variable.c
+++ b/plugins/pychrysalide/analysis/variable.c
@@ -35,6 +35,7 @@
#include <analysis/variable.h>
+#include "../access.h"
#include "../helpers.h"
@@ -241,7 +242,7 @@ PyTypeObject *get_python_binary_variable_type(void)
/******************************************************************************
* *
-* Paramètres : module = module dont la définition est à compléter. *
+* Paramètres : - *
* *
* Description : Prend en charge l'objet 'pychrysalide.analysis.BinVariable'. *
* *
@@ -251,17 +252,24 @@ PyTypeObject *get_python_binary_variable_type(void)
* *
******************************************************************************/
-bool register_python_binary_variable(PyObject *module)
+bool ensure_python_binary_variable_is_registered(void)
{
- PyTypeObject *py_binary_variable_type; /* Type Python 'BinVariable' */
+ PyTypeObject *type; /* Type Python 'ProxyFeeder' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_binary_variable_type = get_python_binary_variable_type();
+ type = get_python_binary_variable_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.analysis");
- dict = PyModule_GetDict(module);
+ dict = PyModule_GetDict(module);
- if (!register_class_for_pygobject(dict, G_TYPE_BIN_VARIABLE, py_binary_variable_type, &PyGObject_Type))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_VARIABLE, type, &PyGObject_Type))
+ return false;
+
+ }
return true;