You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Python 3.14 compatibility: defer exception raising from signal handlers
Python 3.14 changed recursion checking to use actual C stack pointers
instead of counters. The old implementation called Python code from within
signal handlers before siglongjmp(), causing _Py_CheckRecursiveCall() to
see inconsistent stack pointers and report 'Unrecoverable stack overflow'.
Solution: Never call Python code from within signal handlers.
Changes:
- Added signal_to_raise field to cysigs_t to store deferred signal
- Modified signal handlers to only set flag and longjmp (no Python calls)
- Added _sig_raise_deferred() to raise exceptions after longjmp
- Updated _sig_on_postjmp() to call _sig_raise_deferred() in safe context
This maintains async-signal-safety and ensures Python's stack tracking
remains consistent. All 65 tests pass on Python 3.14.0rc3.
Also updates:
- pyproject.toml: requires-python = '>=3.9,<3.15' (was <3.14)
- CI/CD: Add Python 3.14 to test matrix
0 commit comments