[PyQt] PyQt4 assertion failure while connecting signal
Radek Smejkal
radek.smejkal at laicatc.com
Tue Jun 13 20:43:49 BST 2017
Hi,
An assertion failure will occur when a module compiled with Cython
attempts to connect a signal to a slot. get_receiver() assumes
PyMethodObject always refers to PyFunctionObject. However, Cython does
not implement methods by using PyFunctionObject.
PyMethodObject may refer to any callable object, see
https://docs.python.org/3/c-api/method.html#c.PyMethod_New
https://docs.python.org/2/c-api/method.html#c.PyMethod_New
PyQt: 4.12
SIP: 4.19.2
Python: 3.5.1
Cython: 0.24
Qt: 4.8.2
Patch for PyQt4_gpl_x11-4.12
--- qpy/QtCore/qpycore_pyqtboundsignal.cpp.orig 2016-12-26
14:47:18.000000000 +0100
+++ qpy/QtCore/qpycore_pyqtboundsignal.cpp 2017-06-13 14:00:46.000000000
+0200
@@ -737,10 +737,13 @@
rx_self = PyMethod_GET_SELF(slot);
PyObject *f = PyMethod_GET_FUNCTION(slot);
- Q_ASSERT(PyFunction_Check(f));
- PyObject *f_name_obj = ((PyFunctionObject *)f)->func_name;
+ PyObject *f_name_obj = PyObject_GetAttr(f, qpycore_name_attr_name);
+ if (!f_name_obj)
+ return 0;
+
const char *f_name = sipString_AsASCIIString(&f_name_obj);
+ Py_DECREF(f_name_obj);
Q_ASSERT(f_name);
rx_name = f_name;
This also applies to PyQt4_gpl_x11-4.12.1.dev1703241106.
Best regards
Radek
More information about the PyQt
mailing list