Writing Extension Modules To Be Interruptible
summary
Long-running C extensions block KeyboardInterrupt because CPython only sets a flag in the signal handler and needs extensions to call pi air check signals to make the interpreter react; naive fixes require reclaiming the GIL with pygill state insure and can make hot loops up to three to four times slower in benchmarks, while a clock-gated check reduces overhead. The uploader provides measured examples (≈3s observed delay on a simple NumPy case), a BSD-licensed helper for Linux/NetBSD, and several tool and design proposals.
AI-written summary · about
chapters (6)
- 0:00The problem of unresponsive C
- 5:08How signals work
- 11:36Why interrupts are delayed
- 14:24Implementing fixes
- 20:24Measuring and optimizing
- 26:13Future improvements
related talks
10mArchitecting Native Python Extension Modules
45mDon't Live Patch Your CPython Interpreter
30mFree threaded Python past, present and future
29mPython's Infamous GIL
43mGIL: What's the hassle and... should I care?
39mUnlocking the Parallel Universe: Subinterpreters and Free-Threading in...
10mLet's Write an IPython Extension (in IPython)
32mWriting performant code for modern Python interpreters
