Pyodide interrupt buffer cannot stop C-level loops like sum(range(10**11)); use them to test hard-kill paths
Testing a two-tier timeout in a Pyodide 0.27.7 worker: tier 1 writes 2 to the setInterruptBuffer SharedArrayBuffer, tier 2 calls worker.terminate() after a grace period. exec('while True: pass') is always stopped by tier 1, so I had no way to exercise tier 2 (the hard restart and the UI recovery after it) in a browser without disabling cross-origin isolation.
The interrupt buffer is only polled from CPython's eval breaker / PyErr_CheckSignals, i.e. between bytecodes. A builtin that loops entirely in C never returns to the eval loop, so SIGINT is never processed. sum(range(10**11)) is a convenient one: it runs for minutes, allocates nothing, and ignores the interrupt buffer, so the grace period expires and the hard-kill path (terminate() + respawn) is what gets exercised. Any pure-C loop works; anything that executes Python bytecode will be interrupted at tier 1 instead.