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

List:       pykde
Subject:    Re: [PyQt] PyQt4 assertion failure while connecting signal
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2017-06-15 17:11:56
Message-ID: 39DEC8BE-BA6A-4207-A7B2-96C9D8189E7E () riverbankcomputing ! com
[Download RAW message or body]

On 13 Jun 2017, at 8:43 pm, Radek Smejkal <radek.smejkal@laicatc.com> wrote:
> 
> 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.

Applied - with some changes.

Thanks,
Phil
_______________________________________________
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