PyQt6: pyqtSignal with an enum raises an SystemError

Ales Erjavec ales.erjavec324 at gmail.com
Fri Apr 23 15:03:00 BST 2021


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).

Best wishes
Aleš Erjavec


More information about the PyQt mailing list