summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/common/pathname.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/common/pathname.c')
-rw-r--r--plugins/pychrysalide/common/pathname.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/plugins/pychrysalide/common/pathname.c b/plugins/pychrysalide/common/pathname.c
index 40977df..c2d69c6 100644
--- a/plugins/pychrysalide/common/pathname.c
+++ b/plugins/pychrysalide/common/pathname.c
@@ -35,6 +35,9 @@
#include <common/pathname.h>
+#include "../access.h"
+
+
/* Calcule le chemin relatif entre deux fichiers donnés. */
static PyObject *py_build_relative_filename(PyObject *, PyObject *);
@@ -183,21 +186,31 @@ PyTypeObject *get_python_pathname_type(void)
* *
******************************************************************************/
-bool register_python_pathname(PyObject *module)
+bool ensure_python_pathname_is_registered(void)
{
- PyTypeObject *py_pathname_type; /* Type Python pour 'pathname' */
+ PyTypeObject *type; /* Type Python pour 'pathname' */
+ PyObject *module; /* Module à recompléter */
int ret; /* Bilan d'un appel */
- py_pathname_type = get_python_pathname_type();
+ type = get_python_pathname_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ //type->tp_new = PyType_GenericNew;
- //py_pathname_type->tp_new = PyType_GenericNew;
+ if (PyType_Ready(type) != 0)
+ return false;
- if (PyType_Ready(py_pathname_type) != 0)
- return false;
+ module = get_access_to_python_module("pychrysalide.common");
- Py_INCREF(py_pathname_type);
- ret = PyModule_AddObject(module, "pathname", (PyObject *)py_pathname_type);
+ Py_INCREF(type);
+ ret = PyModule_AddObject(module, "pathname", (PyObject *)type);
+
+ if (ret != 0)
+ return false;
+
+ }
- return (ret == 0);
+ return true;
}