[PyQt] Segfault when calling repr() on a pyqtSignal

Hans-Peter Jansen hpj at urpla.net
Mon Jul 4 05:24:10 BST 2016


On Freitag, 24. Juni 2016 17:58:16 Florian Bruhin wrote:
> I unfortunately can't figure out an example where this happens without
> pytest, but with the attached code, when running py.test repr.py, I
> get a segfault:
> 
> 	(gdb) bt
> 	#0  pyqtBoundSignal_repr (self=0x7fffdf2f02b0) at
> ../qpy/QtCore/qpycore_pyqtboundsignal.cpp:241 #1  0x00007ffff79bc9a8 in
> PyObject_Repr () from /usr/lib/libpython3.5m.so.1.0 [...]
> 
> The simplified pyqtBoundSignal_repr looks like this:
> 
>     PyUnicode_FromFormat("<bound PYQT_SIGNAL %s of %s object at %p>"
>                          name.constData() + 1,
> 	                     bs->bound_pyobject->ob_type->tp_name,
>                          bs->bound_pyobject);
> 
> Looking at the data with gdb:
> 
> 	(gdb) p bs
> 	$11 = (qpycore_pyqtBoundSignal *) 0x7fffdf2f02b0
> 	(gdb) p bs->bound_pyobject
> 	$12 = (PyObject *) 0x7fffdf0594c8
> 	(gdb) p bs->bound_pyobject->ob_type
> 	$13 = (_typeobject *) 0x43
> 	(gdb) p bs->bound_pyobject->ob_type->tp_name
> 	Cannot access memory at address 0x5b
> 
> Not sure what's going on exactly, but I hope that helps!

Florian, with which sip/PyQt/Python version(s) does this happen?

Pete



More information about the PyQt mailing list