Skip to content

fix(uinput): build enums via functional IntEnum API (fixes #24); require Python 3.11#102

Closed
Patola wants to merge 2 commits into
C0rn3j:mainfrom
Patola:require-python-3.11
Closed

fix(uinput): build enums via functional IntEnum API (fixes #24); require Python 3.11#102
Patola wants to merge 2 commits into
C0rn3j:mainfrom
Patola:require-python-3.11

Conversation

@Patola

@Patola Patola commented Jul 6, 2026

Copy link
Copy Markdown

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/Rels are built with a class body doing locals().update({...}), which relies on dict.update() reaching enum's _EnumDict.__setitem__ — which it does not on Python ≤ 3.10. Every member is silently dropped, scc.uinput imports an EMPTY enum, and the daemon/GUI die at startup with KeyError: '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 functional IntEnum(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-python moves to >=3.11 for 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.

Patola and others added 2 commits July 6, 2026 21:59
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>
@C0rn3j

C0rn3j commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Fixed in d4241bb and e28d007 by dropping jammy and bumping minimal version to 3.11.

That also allowed us to remove other workarounds, so that's nice.

@C0rn3j C0rn3j closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError: 'KEY_ESC' when starting daemon in 0.4.9.0.1-bullseye

2 participants