[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Segfault when calling repr() on a pyqtSignal
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2016-06-24 15:58:16
Message-ID: 20160624155816.fudhvyx3dnutrj2l () tonks
[Download RAW message or body]

This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

[Attachment #2 (multipart/signed)]
This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

[Attachment #4 (multipart/mixed)]


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

-- 
http://www.the-compiler.org | me@the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/

["repr.py" (text/x-python)]

import pytest
from PyQt5.QtCore import pyqtSignal, QObject


class SignalObject(QObject):

    signal1 = pyqtSignal()


@pytest.mark.parametrize('signal, expected', [
    (SignalObject().signal1, 'signal1'),
])
def test_signal_name(signal, expected):
    print(repr(signal))

["signature.asc" (application/pgp-signature)]
[Attachment #9 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic