diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-08-27 00:26:20 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-08-27 00:26:20 (GMT) |
commit | e07a541d1dea13a19a587f2b97d12ed3443f235b (patch) | |
tree | 95ef0ba21345c34c7c246ff824ba70317b810717 /plugins/pychrysa/helpers.c | |
parent | 50a657889a32a6df365bf9880a6f56bf3a0e828c (diff) |
Redefined and improved the load process for Python plugins.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@572 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/helpers.c')
-rw-r--r-- | plugins/pychrysa/helpers.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/pychrysa/helpers.c b/plugins/pychrysa/helpers.c index d344a7f..5ba2fb4 100644 --- a/plugins/pychrysa/helpers.c +++ b/plugins/pychrysa/helpers.c @@ -27,6 +27,36 @@ /****************************************************************************** * * +* Paramètres : target = propriétaire de la routine visée. * +* method = désignation de la fonction à appeler. * +* * +* Description : Indique si une routine Python existe ou non. * +* * +* Retour : Bilan de l'analyse. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool has_python_method(PyObject *module, const char *method) +{ + bool result; /* Bilan à retourner */ + PyObject *func; /* Fonction visée */ + + func = PyObject_GetAttrString(module, method); + if (func == NULL) return false; + + result = PyCallable_Check(func); + + Py_DECREF(func); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : func = fonction Python à appeler. * * args = arguments à associer à l'opération. * * * |