PyQt6: pyqtSignal with an enum raises an SystemError

Phil Thompson phil at riverbankcomputing.com
Sun Apr 25 12:17:28 BST 2021


On 23/04/2021 15:03, Ales Erjavec wrote:
> Hi,
> 
> Declaring a pyqtSignal with an Enum type raises a SystemError:
> ```
> import enum
> from PyQt6.QtCore import QObject, pyqtSignal
> 
> 
> class E(enum.Enum):
>     A = 1
>     B = 2
> 
> 
> class Obj(QObject):
>     sig = pyqtSignal(E)  # << SystemError
> ```
> 
> The error is:
> ```
> Traceback (most recent call last):
>   File "C:\<...>\Python38\lib\enum.py", line 380, in __getattr__
>     raise AttributeError(name)
> AttributeError: __sip__
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
>   File "test.py", line 10, in <module>
>     class Obj(QObject):
>   File "test.py", line 15, in Obj
>     sig = pyqtSignal(E)
> SystemError: <class 'PyQt6.QtCore.pyqtSignal'> returned a result with
> an error set
> ```
> This worked in PyQt5 where `pyqtSignal(E)` would simply be a
> equivalent to pyqtSignal(object).

I think this has been fixed.

Phil


More information about the PyQt mailing list