Repository navigation
Python 3.11.4 on Debian: ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648 #7735
Copy link
Copy link
Closed
Labels
bug: exceptionA Python exception gets thrown.A Python exception gets thrown.component: keyinputIssues related to processing keypresses.Issues related to processing keypresses.priority: 0 - highIssues which are currently the primary focus.Issues which are currently the primary focus.qt: 6Issues related to Qt 6.Issues related to Qt 6.
Description
Using master branch on Debian Sid with qt6.
Python 3.11.4-1 packages landed (in unstable) and broke qutebrowser.
Same with 3.11.3-2 (was in experimental only).
3.11.2-6 is good.
Traceback (most recent call last):
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/eventfilter.py", line 104, in eventFilter
return handler(cast(QKeyEvent, event))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/eventfilter.py", line 74, in _handle_key_event
return man.handle_event(event)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/modeman.py", line 471, in handle_event
return handler(cast(QKeyEvent, event))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/modeman.py", line 292, in _handle_keypress
match = parser.handle(event, dry_run=dry_run)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/modeparsers.py", line 115, in handle
match = super().handle(e, dry_run=dry_run)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/basekeyparser.py", line 295, in handle
self._debug_log(f"Got key: {info!r} (dry_run {dry_run})")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/keyutils.py", line 371, in __repr__
text=str(self),
^^^^^^^^^
File "/home/ander/Desktop/qutebrowser/qutebrowser/keyinput/keyutils.py", line 422, in __str__
modifiers &= ~_MODIFIER_MAP[self.key] # type: ignore[assignment]
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1542, in __invert__
self._inverted_ = self.__class__(self._flag_mask_ ^ self._value_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 711, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1136, in __new__
raise exc
File "/usr/lib/python3.11/enum.py", line 1113, in __new__
result = cls._missing_(value)
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1454, in _missing_
raise ValueError('%r: no members with value %r' % (cls, unknown))
ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648
Fatal Python error: Segmentation fault
Current thread 0x00007f66d9330040 (most recent call first):
File "/home/ander/Desktop/qutebrowser/qutebrowser/app.py", line 140 in qt_mainloop
File "/home/ander/Desktop/qutebrowser/qutebrowser/app.py", line 130 in run
File "/home/ander/Desktop/qutebrowser/qutebrowser/qutebrowser.py", line 245 in main
File "/home/ander/Desktop/qutebrowser/.venv/bin/qutebrowser", line 33 in <module>
Extension modules: PyQt6.QtCore, PyQt6.QtGui, PyQt6.QtWidgets, markupsafe._speedups, yaml._yaml, PyQt6.QtNetwork, PyQt6.QtQml, PyQt6.QtOpenGL, PyQt6.QtDBus, PyQt6.QtWebChannel, PyQt6.QtWebEngineCore, PyQt6.QtPrintSupport, PyQt6.QtWebEngineWidgets, PyQt6.QtSql (total: 14)
Segmentation fault
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug: exceptionA Python exception gets thrown.A Python exception gets thrown.component: keyinputIssues related to processing keypresses.Issues related to processing keypresses.priority: 0 - highIssues which are currently the primary focus.Issues which are currently the primary focus.qt: 6Issues related to Qt 6.Issues related to Qt 6.
Activity
[-]Python 3.11.4 segmentation fault[/-][+]Python 3.11.3 and 3.11.4 segmentation fault[/+]The-Compiler commentedon Jun 8, 2023
Works fine here on Archlinux with 3.11.3.
Confusingly, I can see in Debian's Package Tracker that the versions you mention indeed exist, but the git link there has its latest change a month ago...
Given this has worked fine for everyone outside of Debian so far, and their rather large amount of patches on top of Python, I wonder if those break something?
In any case, the actual issue is probably
ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648and not the segfault. That value is 0x80000000.Can you please show your full
--versioninformation (assuming that should still work fine), as well as the output you get before the exception with--debug?[-]Python 3.11.3 and 3.11.4 segmentation fault[/-][+]Python 3.11.3/.4 on Debian: ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648[/+][-]Python 3.11.3/.4 on Debian: ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648[/-][+]Python 3.11.4 on Debian: ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648[/+]The-Compiler commentedon Jun 8, 2023
Reproduced with Python 3.11.4. I'm assuming the 3.11.3 thing was a red herring (maybe you had an existing instance still open?).
Logs:
Assuming it's this change: python/cpython#103365
This seems... like pretty bad for a patch release!
4nd3r commentedon Jun 8, 2023
Nope.
Downloaded related packages from snapshot.debian.org:
Same problem with
.4(currently in repo) and.3(from snapshot).Nothing special there. For example:
Only line, that changes in meaningful way for each Python version, is
^CPython:.The-Compiler commentedon Jun 8, 2023
Ah, looks like the Debian 3.11.3-2 from experimental isn't actually Python 3.11.3 if I'm reading the changelog right, but something entirely in between:
But the 3.11.3 upstream release was actually from April 5th, and the offending change was merged on April 13th...
With that mystery out of the way - reported to CPython and PyQt:
It looks like a workaround is possible, though. I'm surprised Qt 5 seems to work fine, but it handles those things a little differently.
From a first look through the source, if only inverting is the problem, those should be the only lines possibly affected:
keyutils: Work around broken Python 3.11.4 enum.Flag inversion