diff options
Diffstat (limited to 'plugins/pychrysalide/helpers.c')
-rw-r--r-- | plugins/pychrysalide/helpers.c | 29 |
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) |