summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/common
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-12 17:02:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-12 17:02:49 (GMT)
commitd5b598b14fd4c50847ce536692ded258ba1720ca (patch)
treebee74e8bcdd642bf67103529991be9d587c6d1da /plugins/pychrysalide/common
parentedcd7a2e2919ea880f8aaf649cf7ed8f1eabac1a (diff)
Registered basic Python objects in the features namespace.
Diffstat (limited to 'plugins/pychrysalide/common')
-rw-r--r--plugins/pychrysalide/common/bits.c6
-rw-r--r--plugins/pychrysalide/common/fnv1a.c9
-rw-r--r--plugins/pychrysalide/common/pathname.c7
3 files changed, 6 insertions, 16 deletions
diff --git a/plugins/pychrysalide/common/bits.c b/plugins/pychrysalide/common/bits.c
index 62aeb6d..7a6454d 100644
--- a/plugins/pychrysalide/common/bits.c
+++ b/plugins/pychrysalide/common/bits.c
@@ -762,7 +762,6 @@ bool ensure_python_bitfield_is_registered(void)
{
PyTypeObject *type; /* Type Python pour 'bitfield' */
PyObject *module; /* Module à recompléter */
- int ret; /* Bilan d'un appel */
type = get_python_bitfield_type();
@@ -773,10 +772,7 @@ bool ensure_python_bitfield_is_registered(void)
module = get_access_to_python_module("pychrysalide.common");
- Py_INCREF(type);
- ret = PyModule_AddObject(module, "bitfield", (PyObject *)type);
-
- if (ret != 0)
+ if (!register_python_module_object(module, type))
return false;
}
diff --git a/plugins/pychrysalide/common/fnv1a.c b/plugins/pychrysalide/common/fnv1a.c
index 759c7ea..5caad48 100644
--- a/plugins/pychrysalide/common/fnv1a.c
+++ b/plugins/pychrysalide/common/fnv1a.c
@@ -32,6 +32,7 @@
#include "../access.h"
+#include "../helpers.h"
@@ -130,9 +131,8 @@ PyTypeObject *get_python_fnv1a_type(void)
bool ensure_python_fnv1a_is_registered(void)
{
- PyTypeObject *type; /* Type Python pour 'fnv1a' */
+ PyTypeObject *type; /* Type Python pour 'fnv1a' */
PyObject *module; /* Module à recompléter */
- int ret; /* Bilan d'un appel */
type = get_python_fnv1a_type();
@@ -145,10 +145,7 @@ bool ensure_python_fnv1a_is_registered(void)
module = get_access_to_python_module("pychrysalide.common");
- Py_INCREF(type);
- ret = PyModule_AddObject(module, "fnv1a", (PyObject *)type);
-
- if (ret != 0)
+ if (!register_python_module_object(module, type))
return false;
}
diff --git a/plugins/pychrysalide/common/pathname.c b/plugins/pychrysalide/common/pathname.c
index c2d69c6..e07ebe5 100644
--- a/plugins/pychrysalide/common/pathname.c
+++ b/plugins/pychrysalide/common/pathname.c
@@ -36,6 +36,7 @@
#include "../access.h"
+#include "../helpers.h"
@@ -190,7 +191,6 @@ bool ensure_python_pathname_is_registered(void)
{
PyTypeObject *type; /* Type Python pour 'pathname' */
PyObject *module; /* Module à recompléter */
- int ret; /* Bilan d'un appel */
type = get_python_pathname_type();
@@ -203,10 +203,7 @@ bool ensure_python_pathname_is_registered(void)
module = get_access_to_python_module("pychrysalide.common");
- Py_INCREF(type);
- ret = PyModule_AddObject(module, "pathname", (PyObject *)type);
-
- if (ret != 0)
+ if (!register_python_module_object(module, type))
return false;
}