Python 3.11.4 and Qt.KeyboardModifier bug
John Ehresman
jpe at wingware.com
Mon Aug 21 11:40:47 BST 2023
~Qt.KeyboardModifier.AltModifier raises an exception when using Python 3.11.4 and PyQt6.5. The exception is as follows --
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt6.QtCore import Qt
>>> ~Qt.KeyboardModifier.AltModifier
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python311\Lib\enum.py", line 1542, in __invert__
self._inverted_ = self.__class__(self._flag_mask_ ^ self._value_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\enum.py", line 711, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\enum.py", line 1136, in __new__
raise exc
File "C:\Python311\Lib\enum.py", line 1113, in __new__
result = cls._missing_(value)
^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\enum.py", line 1454, in _missing_
raise ValueError('%r: no members with value %r' % (cls, unknown))
ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648
I happened to test Python 3.11.2 with PyQt6.5 and it works there. The exception might be due to Qt.KeyboardModifier.KeyboardModifierMask including bits that aren’t assigned a name, but I’m not sure.
Thanks,
John
More information about the PyQt
mailing list