fix: segfault on Python 3.14 in libei variadic function call#7
Open
davidselassie wants to merge 2 commits intoisac322:mainfrom
Open
fix: segfault on Python 3.14 in libei variadic function call#7davidselassie wants to merge 2 commits intoisac322:mainfrom
davidselassie wants to merge 2 commits intoisac322:mainfrom
Conversation
## Summary Set `argtypes` on `ei_seat_bind_capabilities` — a variadic C function whose argtypes were intentionally left unset because ctypes historically didn't require them. On Python 3.14 this causes a segfault (exit code 139) during session start, as ctypes misinterprets the variadic arguments at the C ABI level without the fixed parameter declaration. ## Motivation `uvx install kwin-mcp` does not respect `.python-version` — it uses whatever Python satisfies `requires-python` (>=3.12). Users on systems with Python 3.14 as default (e.g. Fedora 43) hit this crash immediately on session start. The fix sets `argtypes` to just the fixed parameter (the seat pointer); the variadic arguments at the call site are already wrapped as ctypes instances and pass through correctly. ## How to Test 1. `uv python pin 3.14 && uv sync` 2. Revert the fix in `src/kwin_mcp/input.py` 3. `echo "session_start" | uv run python -m kwin_mcp.cli` → exit code 139 (SIGSEGV) 4. Restore the fix, re-run → session starts normally 5. `uv python pin 3.12 && uv sync` to restore ## Checklist - [x] `uv run ruff check .` passes - [x] `uv run ruff format --check .` passes - [x] `uv run ty check` passes - [ ] CHANGELOG.md updated (if user-facing change) - [ ] README.md updated (if new tools or changed behavior) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Set
argtypesonei_seat_bind_capabilities— a variadic C functionwhose argtypes were intentionally left unset because ctypes historically
didn't require them. On Python 3.14 this causes a segfault (exit code
139) during session start, as ctypes misinterprets the variadic arguments
at the C ABI level without the fixed parameter declaration.
Motivation
uvx install kwin-mcpdoes not respect.python-version— it useswhatever Python satisfies
requires-python(>=3.12). Users on systemswith Python 3.14 as default (e.g. Fedora 43) hit this crash immediately
on session start. The fix sets
argtypesto just the fixed parameter(the seat pointer); the variadic arguments at the call site are already
wrapped as ctypes instances and pass through correctly.
How to Test
uv python pin 3.14 && uv syncsrc/kwin_mcp/input.pyecho "session_start" | uv run python -m kwin_mcp.cli→ exit code 139 (SIGSEGV)uv python pin 3.12 && uv syncto restoreChecklist
uv run ruff check .passesuv run ruff format --check .passesuv run ty checkpasses