[PyQt] SIP and PyPy

Phil Thompson phil at riverbankcomputing.com
Thu Oct 20 22:03:28 BST 2016

On 20 Oct 2016, at 8:37 pm, Matti Picus <matti.picus at gmail.com> wrote:
> I am a PyPy dev, working on making our C-API layer compatible with CPython.
> I spent some time with SIP today, trying to make the wxPython bindings work.
> I am using the latest HEAD version of PyPy and, AFAICT the 4.8.1 version of SIP.
> I have a problem with the tp_alloc functions in siplib.c, specifically sipEnumType_alloc and sipWrapperType_alloc.
> According to the C-API documentation, https://docs.python.org/2/c-api/typeobj.html#c.PyTypeObject.tp_alloc, "Do not use this function to do any other instance initialization, not even to allocate additional memory; that should be done by tp_new" but these functions do much more.
> Presently PyPy does not allow overriding the tp_alloc function at all, so from my perspective all the more reason to be pedantic about not doing too much in tp_alloc :).
> My questions are: how can I work with the SIP people to make SIP work with PyPy (is there a test suite, continuous build or something like that), and more specifically would you be willing to accept a patch to move the initialization code from tp_alloc to tp_init? What are the implications for other users of SIP?

The current implementation is there for a reason - but that reason may be historic (the original code was written for Python v1.5).

I'm happy to consider a patch, however v4.8.1 was released over 7 years ago.


More information about the PyQt mailing list