When writing Cython code, special care must be
taken to ensure that the code can be interrupted with
Since Cython optimizes for speed, Cython normally does not check for
interrupts. For example, code like the following cannot be interrupted
while True: pass
While this is running, pressing
CTRL-C has no effect. The only way
out is to kill the Python process. On certain systems, you can still
quit Python by typing
CTRL-\ (sending a Quit signal) instead of
The package cysignals provides functionality to deal with this,
see Interrupt handling.
Besides this, cysignals also provides Python functions/classes to deal with signals. These are not directly related to interrupts in Cython, but provide some supporting functionality beyond what Python provides, see Signal-related interfaces for Python code.
Dealing with interrupts and other signals using