Commit 4fa528d
committed
Fix signal-based interrupt on non-main threads
Add a check to detect if the current thread is the main thread before
attempting to set up signal handlers. On Python 3.14+, signal handlers
can only be set up in the main thread of the main interpreter. If not in
the main thread, fall back to non-interruptible execution.
This fixes the test failure in test_interruptible_can_run_function which
was failing with: ValueError: signal only works in main thread of the main
interpreter1 parent 937be2a commit 4fa528d
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| 85 | + | |
83 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| |||
0 commit comments