[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] SIP problem with compiled functions (or anything that is not a function or method)
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2012-02-19 14:02:07
Message-ID: 49aada11d0f028b72883aa253d1d261f () localhost
[Download RAW message or body]
On Sun, 19 Feb 2012 13:42:58 +0100, Kay Hayen <kayhayen@gmx.de> wrote:
> Hello,
>
> I have previously raised the problem, but this time I have a solution as
> well.
>
> /*
> * Emulate the behaviour of a descriptor to make sure we return
> a bound
> * method.
> */
> if (PyMethod_Check(reimp))
> {
> /* It's already a method but make sure it is bound. */
> if (PyMethod_GET_SELF(reimp) != NULL)
> {
> Py_INCREF(reimp);
> }
> else
> {
> #if PY_MAJOR_VERSION >= 3
> reimp = PyMethod_New(PyMethod_GET_FUNCTION(reimp),
> (PyObject *)sipSelf);
> #else
> reimp = PyMethod_New(PyMethod_GET_FUNCTION(reimp),
> (PyObject *)sipSelf,
PyMethod_GET_CLASS(reimp));
> #endif
> }
> }
> else if (PyFunction_Check(reimp))
> {
> #if PY_MAJOR_VERSION >= 3
> reimp = PyMethod_New(reimp, (PyObject *)sipSelf);
> #else
> reimp = PyMethod_New(reimp, (PyObject *)sipSelf, cls);
> #endif
> }
> else
> {
> /*
> * We don't know what it is so just return and assume that
an
> * appropriate exception will be raised later on.
> */
> Py_INCREF(reimp);
> }
>
>
> Now I don't know the rationale for making an emulation. But if I add
> this before the else:
>
> else if (Py_TYPE(reimp)->tp_descr_get)
> {
> reimp = Py_TYPE(reimp)->tp_descr_get(reimp, (PyObject
> *)sipSelf, cls);
> }
>
> it just asks whatever object it is to bind itself to the given object
> and class. Can you please consider this change? It makes PyQt work with
> Nuitka out of the box.
Seems to be a safe enough change - applied.
Phil
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://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