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

Kyle Altendorf sda at fstab.net
Wed May 1 16:34:42 BST 2019


On 2019-05-01 05: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.

What about this?  Maybe check it in both the 'working' and 'non-working' 
scenarios.

    import PyQt5.QtCore
    print(PyQt5.QtCore.True)
    print(PyQt5.QtCore.__all__)

Cheers,
-kyle


More information about the PyQt mailing list