Python 3.12 segfault with mixin classes

Thomas Caswell tcaswell at gmail.com
Tue Jun 20 16:54:21 BST 2023


I was mistaken in my last email, the latest pyqt6 snapshot works with the
branch in https://github.com/python/cpython/pull/105747

Tom

On Tue, Jun 20, 2023 at 11:09 AM Thomas Caswell <tcaswell at gmail.com> wrote:

> I can confirm that the latest pyqt6 snapshots and CPython main branch work
> together.
>
> Tom
>
> On Fri, Jun 16, 2023 at 10:36 AM Phil Thompson <
> phil at riverbankcomputing.com> wrote:
>
>> On 15/06/2023 19:03, Florian Bruhin wrote:
>> > Hey,
>> >
>> >> When trying PyQt 6.5.1 with Python 3.12 Beta 2, something like:
>> >>
>> >>         import sys
>> >>         from PyQt6.QtWidgets import QWidget, QApplication
>> >>
>> >>         class Mixin: pass
>> >>         class Command(Mixin, QWidget): pass
>> >>
>> >>         app = QApplication(sys.argv)
>> >>         cmd = Command()
>> >>         cmd.show()
>> >>         app.exec()
>> >>
>> >> segfaults here on the "cmd.Command()" line:
>> >>
>> >>         #0  [...] _PyDict_Next (op=0x0, [...])
>> >>         [...]
>> >>         #2  [...]  in trawl_hierarchy([...])
>> >>            from .../lib/python3.12/site-packages/PyQt6/QtCore.abi3.so
>> >>         [...]
>> >
>> > Eric Snow commented on the issue:
>> >
>> >     Presumably the crashing code is trying to use the dict returned by
>> >     sipPyTypeDict() and I'm guessing that that function basically
>> > returns
>> >     pytype->tp_dict and that the pytype in question is a static builtin
>> >     type. If that's the case then the failure makes sense since tp_dict
>> > for
>> >     static builtin types is now NULL.
>> >
>> > And that indeed seems to be the case: trawl_type does
>> > "dict = sipPyTypeDict(pytype);", that is an alias to sip's
>> > api_py_type_dict, and that accesses py_type->tp_dict.
>> >
>> > See:
>> > https://github.com/python/cpython/issues/105227
>> >
>> > There is now an open PR to add a PyType_GetDict():
>> > https://github.com/python/cpython/pull/105747
>>
>> Hopefully fixed in tonight's snapshot - although it needs the next beta
>> release of Python v3.12 to build.
>>
>> Phil
>>
>
>
> --
> Thomas Caswell
> tcaswell at gmail.com
>


-- 
Thomas Caswell
tcaswell at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230620/a1f216e6/attachment.htm>


More information about the PyQt mailing list