Unsupported return type QList<qint64>
Phil Thompson
phil at riverbankcomputing.com
Sat Jun 29 12:06:14 BST 2024
On 24/06/2024 14:13, Julien Cabieces wrote:
> Hi,
>
>> On 20/06/2024 09:38, Julien Cabieces wrote:
>>> Sorry Phil I answered directly to you instead of the list, here is
>>> the
>>> same message and more.
>>> QList is a template mapped type so it should work with other
>>> primitive type, no?
>>
>> No. Mapped type templates only work as templates when type arguments
>> are wrapped types. With other type arguments (eg. primitive types)
>> they work as template selectors. This is because the Python API is
>> different for converting different primitive types.
>>
>>> It does work with QList<long long> although there
>>> is no mapped type
>>> provided, and qint64 is nothing more than a long long.
>>
>> SIP will select a template based on the underlying primitive types
>> (ie. after resolving any typedefs) according to the current platform
>> and version of Qt. PyQt implements a mapped type for QList<qsizetype>
>> when building against Qt v6.5.0 or later. PyQt defines both qint64 and
>> qsizetype as long long so it will pick that mapped type for Qt v6.5.0
>> or later and fail with earlier versions.
>>
>
> thanks for detailed explanations, it's clearer now!
>
>>> Contrary to what I said before, it doesn't look like it's
>>> related to different minor version of sip 6.
>>> According to my test:
>>> - QList<qint64> works with sip 6 on fedora (39, 40) but fails on
>>> debian
>>> (stable, testing, unstable).
>>> - QList<qint64> has never worked with sip 4 (fedora or debian).
>>
>> You mention PyQt6-Qt6 but this is irrelevant as you aren't building
>> against that Qt installation. I assume you are building against the
>> distro's Qt installation.
>>
>
> Yes, you're right. I tried also to reproduce the issue with pip to
> understand where it was coming from. I tried then with pure fedora and
> debian
> docker, without pip and that's where my test results come from.
>
>> Do Fedora and Debian have different versions
>> of Qt?
>
> Yes, they have different versions. For instance:
> - Debian:testing : pyqt6 6.6.1-2 / Qt 6.4.2 / sip 6.8.3 (not
> working)
> - Debian:unstable : pyqt6 6.7.0-1 / Qt 6.6.2 / sip 6.8.5 (not working)
> - fedora:40 : pyqt6 6.7.0-2 / Qt 6.7.1-2 / 6.8.2-2 (working)
>
> As you can see, Debian:unstable and fedora:40 are pretty close in
> versions, and both above 6.5.0. Both have the same
> qglobal.sip/qtypes.sip declaration regarding qint64.
>
> The only differences I see are where bindings are stored:
> - fedora /usr/lib64/python3.12/site-packages/PyQt6/bindings/
> - debian unstable /usr/lib/python3/dist-packages/PyQt6/bindings/QtCore/
>
> And python version
>
> - fedora is python 3.12.3
> - debian unstable is 3.11.9.
>
> Does that matter ?
It shouldn't do. You are talking about different distros with their own
standards and patches - I know nothing about them.
>>> Any idea on how to fix this except for a "if debian" directives?
>>
>> The correct fix is to provide your own QList<qint64> mapped type
>> (maybe only with version of Qt older than v6.5).
>>
>
> Actually, it doesn't look like related to versions, but more the way
> they are packaged.
The root issue is versions.
> I added the file I use as example to reproduce the issue, in any case
> you spot something odd.
As I said before, the correct fix is for you to provide an
implementation. The absence of an implementation is a bug in your code.
You can copy the QList<qsizetype> implementation from PyQt and adjust
appropriately.
Phil
More information about the PyQt
mailing list