A lightweight cooperative timeout mechanism for synchronous code `with timeout(seconds):`

Related discussions about cancellations at the Python level:

(By the way, Trio changed its KeyboarInterrupt protection implementation in v0.28.0, slightly different implementation, but the same idea.)

2 Likes