[PyQt] Attribute type change problem while using Qt 5.12 / PyQt 5.12.1 and wildcard imports

Ümit Öztosun umit at oztosun.net
Wed May 1 13:02:58 BST 2019



> On 1 May 2019, at 13:19, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> On 01/05/2019 10:55, Ümit Öztosun wrote:
>> Hello,
>> I have encountered a weird problem using PyQt 5.12.1 and Qt 5.12. Take
>> the following script:
>> from PyQt5.QtCore import *
>> class A(QObject):
>>    flag = True
>> a = A()
>> print a.flag
>> This outputs QCborSimpleType.True. Boolean attribute somehow converted to
>> a QCborSimpleType. However, just changing the wildcard import corrects
>> output:
>> from PyQt5.QtCore import QObject
>> class A(QObject):
>>    flag = True
>> a = A()
>> print a.flag
>> Output is True this time.
>> I have tried various configurations, here are the wildcard import test
>> outputs: (Qt/Sip/PyQt all are compiled from source)
>> Ubuntu 18.04 / Qt-5.12.3 / sip-4.19.16 / PyQt5_gpl-5.12.1
>> => QCborSimpleType.True
>> Ubuntu 18.04 / Qt-5.12.3 / sip-4.19.16 / PyQt5_gpl-5.12.2.dev1904191828
>> => QCborSimpleType.True
>> MacOS 10.14.4 / Qt-5.12.3 / sip-4.19.16 / PyQt5_gpl-5.12.1
>> => QCborSimpleType.True
>> Ubuntu 18.04 / Qt-5.11.3 / sip-4.19.16 / PyQt5_gpl-5.12.1
>> => True
>> Problem only occurs while using Qt-5.12. Using Qt-5.11 brings things to
>> normal. AFAIK CBOR support was added in Qt 5.12 and this may be related:
>> https://doc.qt.io/qt-5/whatsnew512.html
>> Any ideas?
> 
> Works fine for me (although I haven't tried it with Python v2). Weird things like this are usually build problems, mis-matched versions, old things lying around.
> 
> Phil

Hi Phil,

I have missed the important part; yes this was on Python 2.7. I have spun up a new Ubuntu 18.04 VM for the tests, just to make sure build is clean. I have build Sip-4.19.16 and PyQt5_gpl5.12.1 using Qt-5.12.3 for Python v3 after your response, and this build does not have the mentioned problem. But Python v2 has it. Python versions used are Python 2.7.15rc1 and Python 3.6.7.

Regards,
Umit Oztosun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190501/182e42ec/attachment.html>


More information about the PyQt mailing list