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

Phil Thompson phil at riverbankcomputing.com
Sun Jul 3 23:46:15 BST 2016


On 24 Jun 2016, at 4:58 pm, Florian Bruhin <me at the-compiler.org> 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!

Is pytest doing something "clever"?

Phil


More information about the PyQt mailing list