summaryrefslogtreecommitdiff
path: root/plugins/yaml/python/pair.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/yaml/python/pair.c')
-rw-r--r--plugins/yaml/python/pair.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/yaml/python/pair.c b/plugins/yaml/python/pair.c
index 59ca0a9..1fffbeb 100644
--- a/plugins/yaml/python/pair.c
+++ b/plugins/yaml/python/pair.c
@@ -31,6 +31,7 @@
#include <i18n.h>
+#include <plugins/pychrysalide/access.h>
#include <plugins/pychrysalide/helpers.h>
@@ -501,7 +502,6 @@ PyTypeObject *get_python_yaml_pair_type(void)
.tp_init = py_yaml_pair_init,
.tp_new = py_yaml_pair_new,
-
};
return &py_yaml_pair_type;
@@ -511,7 +511,7 @@ PyTypeObject *get_python_yaml_pair_type(void)
/******************************************************************************
* *
-* Paramètres : module = module dont la définition est à compléter. *
+* Paramètres : - *
* *
* Description : Prend en charge l'objet 'pychrysalide.plugins.....YamlPair. *
* *
@@ -521,22 +521,27 @@ PyTypeObject *get_python_yaml_pair_type(void)
* *
******************************************************************************/
-bool register_python_yaml_pair(PyObject *module)
+bool ensure_python_yaml_pair_is_registered(void)
{
PyTypeObject *type; /* Type Python 'YamlPair' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
type = get_python_yaml_pair_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.plugins.yaml");
- /* TODO : get_python_yaml_node_type() */
+ dict = PyModule_GetDict(module);
- if (!register_class_for_pygobject(dict, G_TYPE_YAML_PAIR, type))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_YAML_PAIR, type))
+ return false;
- if (!define_yaml_pair_constants(type))
- return false;
+ if (!define_yaml_pair_constants(type))
+ return false;
+
+ }
return true;