diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-07-17 16:36:21 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-07-17 16:36:21 (GMT) |
commit | 24d3836fcf8d443eb654b981f65478cd9923b8f1 (patch) | |
tree | 7672a28b864127e8958c3c6cce751dcf646d2fbe /plugins/pychrysa/helpers.h | |
parent | a61f089babe336b012da31a494b0f7470b6e1a9a (diff) |
Updated the Python bindings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@552 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/helpers.h')
-rw-r--r-- | plugins/pychrysa/helpers.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/plugins/pychrysa/helpers.h b/plugins/pychrysa/helpers.h index f957b9d..d47d8e7 100644 --- a/plugins/pychrysa/helpers.h +++ b/plugins/pychrysa/helpers.h @@ -26,14 +26,35 @@ #include <Python.h> +#include <stdbool.h> /* Appelle une routine Python. */ -PyObject *run_python_method(PyObject *, const char *, PyObject *); +PyObject *_run_python_method(PyObject *, PyObject *); /* Appelle une routine Python. */ -PyObject *_run_python_method(PyObject *, PyObject *); +PyObject *run_python_method(PyObject *, const char *, PyObject *); + +/* Ajoute une constante au dictionnaire d'un type Python donné. */ +bool PyDict_AddIntConstant(PyTypeObject *, const char *, long); + +/* Ajoute une constante au dictionnaire d'un type Python donné. */ +bool PyDict_AddStringConstant(PyTypeObject *, const char *, const char *); + + +#define PyDict_AddIntMacro(tp, c) PyDict_AddIntConstant(tp, #c, c) +#define PyDict_AddStringMacro(tp, c) PyDict_AddStringConstant(tp, #c, c) + + +/** + * Quelque chose est mal fait au niveau de l'abstraction GObject. + * Du coup, Py_TPFLAGS_IS_ABSTRACT n'est pas pris en compte. + * On force alors la méthode de base pour obtenir un traitement correct. + * + * Cf. http://stackoverflow.com/questions/20432335/can-python-abstract-base-classes-inherit-from-c-extensions + */ +#define APPLY_ABSTRACT_FLAG(tp) tp->tp_new = PyBaseObject_Type.tp_new |