summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/helpers.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-07 20:33:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-07 20:33:21 (GMT)
commitc0af4cc392a246b05d41b7b7c05bbcd8b0cfb39e (patch)
tree0d645c71c40fc4b625271d0ab1ef8e7ebab04075 /plugins/pychrysalide/helpers.c
parenta13d12c758184449bf3305785ef33273802a761c (diff)
Relied on GObject introspection and dynamic gtypes to inherit in Python.
Diffstat (limited to 'plugins/pychrysalide/helpers.c')
-rw-r--r--plugins/pychrysalide/helpers.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/plugins/pychrysalide/helpers.c b/plugins/pychrysalide/helpers.c
index 4ada405..51c2f31 100644
--- a/plugins/pychrysalide/helpers.c
+++ b/plugins/pychrysalide/helpers.c
@@ -112,12 +112,18 @@ 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 = (PyObject_HasAttrString(module, method) == 1);
- result = PyCallable_Check(func);
+ if (result)
+ {
+ func = PyObject_GetAttrString(module, method);
+ assert(func != NULL);
- Py_DECREF(func);
+ result = PyCallable_Check(func);
+
+ Py_DECREF(func);
+
+ }
return result;
@@ -503,20 +509,15 @@ bool _register_class_for_pygobject(PyObject *dict, GType gtype, PyTypeObject *ty
va_end(ap);
-
+ /**
+ * les renseignements suivants ne semblent pas nécessaires...
+ */
/*
-#0 0x000055555565aad4 in insertdict (mp=0x7fffe7c2c8a8, key='GenConfig', hash=262970853803706525, value=<unknown at remote 0x7ffff6bd9ce0>) at ../Objects/dictobject.c:801
-#1 0x000055555565bf62 in PyDict_SetItem (op={'__doc__': 'Python module for Chrysalide.glibext', '__name__': 'pychrysalide.glibext', 'BufferLine': <type at remote 0x7ffff6bd9760>, '__spec__': None, 'ConfigParam': <type at remote 0x7ffff6bd9a00>, '__package__': None, 'Buffercache': <type at remote 0x7ffff6bd95c0>, 'ConfigParamIterator': <type at remote 0x7ffff6bd9fc0>, '__loader__': None}, key='GenConfig', value=<unknown at remote 0x7ffff6bd9ce0>) at ../Objects/dictobject.c:1227
-#2 0x00005555556610b0 in PyDict_SetItemString (v={'__doc__': 'Python module for Chrysalide.glibext', '__name__': 'pychrysalide.glibext', 'BufferLine': <type at remote 0x7ffff6bd9760>, '__spec__': None, 'ConfigParam': <type at remote 0x7ffff6bd9a00>, '__package__': None, 'Buffercache': <type at remote 0x7ffff6bd95c0>, 'ConfigParamIterator': <type at remote 0x7ffff6bd9fc0>, '__loader__': None}, key=0x7ffff69cd0bd "GenConfig", item=<unknown at remote 0x7ffff6bd9ce0>) at ../Objects/dictobject.c:2870
-#3 0x00007ffff69b3d12 in _register_class_for_pygobject (dict={'__doc__': 'Python module for Chrysalide.glibext', '__name__': 'pychrysalide.glibext', 'BufferLine': <type at remote 0x7ffff6bd9760>, '__spec__': None, 'ConfigParam': <type at remote 0x7ffff6bd9a00>, '__package__': None, 'Buffercache': <type at remote 0x7ffff6bd95c0>, 'ConfigParamIterator': <type at remote 0x7ffff6bd9fc0>, '__loader__': None}, gtype=93824998785328, type=0x7ffff6bd9ce0 <py_generic_config_type>, base=0x7fffe80e72a0 <PyGObject_Type>) at helpers.c:320
+ type->tp_weaklistoffset = offsetof(PyGObject, weakreflist);
+ type->tp_dictoffset = offsetof(PyGObject, inst_dict);
*/
-
-
- //type->tp_weaklistoffset = offsetof(PyGObject, weakreflist);
- //type->tp_dictoffset = offsetof(PyGObject, inst_dict);
-
pygobject_register_class(dict, NULL, gtype, type, static_bases);
if (PyErr_Occurred() == NULL)