fix(uinput): build enums via functional IntEnum API (fixes #24); require Python 3.11#102
Closed
Patola wants to merge 2 commits into
Closed
fix(uinput): build enums via functional IntEnum API (fixes #24); require Python 3.11#102Patola wants to merge 2 commits into
Patola wants to merge 2 commits into
Conversation
The enums are built with a class body doing `locals().update({...})`, which
relies on dict.update() reaching enum's _EnumDict.__setitem__. On Python
<= 3.10 it does not: every member is silently dropped, the enum imports
EMPTY, and scc.uinput dies at import with KeyError: 'KEY_ESC'. That is the
crash reported in C0rn3j#24 (bullseye, Python 3.9), and it also hits any AppImage
whose base distro ships Python 3.10, such as jammy.
Build them with the functional IntEnum(name, mapping) API instead, which
registers every member identically on every Python version (verified:
KEY_ESC=1, BTN_SOUTH=304, ABS_X=0, REL_X=0, all members present).
Fixes C0rn3j#24.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Python 3.10 reaches end-of-life in October 2026; drop it from the supported source floor. The code itself still tolerates 3.10 (the enums are now built with the functional IntEnum API), so the bundled-Python AppImages -- which ship their base distro's Python, e.g. jammy = 3.10 -- keep working. This only raises the floor for source / pip installs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #100 as its own per-problem PR, per @C0rn3j's request in #98 (comment) (ship non-SC2 changes as separate PRs).
The bug (#24).
Keys/KeysOnly/Axes/Relsare built with a class body doinglocals().update({...}), which relies ondict.update()reaching enum's_EnumDict.__setitem__— which it does not on Python ≤ 3.10. Every member is silently dropped,scc.uinputimports an EMPTY enum, and the daemon/GUI die at startup withKeyError: 'KEY_ESC'. That is #24 (bullseye, Python 3.9), and it also breaks any AppImage whose base ships Python 3.10, such as jammy. The functionalIntEnum(name, mapping)API registers every member identically on all versions (verified on 3.10, 3.11, 3.12 and 3.14).The floor. Separately, Python 3.10 is EOL in October 2026, so
requires-pythonmoves to>=3.11for source / pip installs. The functional enum is kept regardless (it is just robust code), so the bundled-Python AppImages that still ship 3.10 keep working.Fixes #24.