Guido van Rossum | abe173a | 1994-06-03 15:58:29 +0000 | [diff] [blame] | 1 | |
| 2 | /* Sigcheck is similar to intrcheck() but sets an exception when an |
| 3 | interrupt occurs. It can't be in the intrcheck.c file since that |
| 4 | file (and the whole directory it is in) doesn't know about objects |
| 5 | or exceptions. It can't be in errors.c because it can be |
| 6 | overridden (at link time) by a more powerful version implemented in |
| 7 | signalmodule.c. */ |
| 8 | |
Guido van Rossum | 79f25d9 | 1997-04-29 20:08:16 +0000 | [diff] [blame] | 9 | #include "Python.h" |
Guido van Rossum | abe173a | 1994-06-03 15:58:29 +0000 | [diff] [blame] | 10 | |
| 11 | /* ARGSUSED */ |
| 12 | int |
Thomas Wouters | f70ef4f | 2000-07-22 18:47:25 +0000 | [diff] [blame] | 13 | PyErr_CheckSignals(void) |
Guido van Rossum | abe173a | 1994-06-03 15:58:29 +0000 | [diff] [blame] | 14 | { |
Guido van Rossum | 79f25d9 | 1997-04-29 20:08:16 +0000 | [diff] [blame] | 15 | if (!PyOS_InterruptOccurred()) |
Guido van Rossum | abe173a | 1994-06-03 15:58:29 +0000 | [diff] [blame] | 16 | return 0; |
Guido van Rossum | 79f25d9 | 1997-04-29 20:08:16 +0000 | [diff] [blame] | 17 | PyErr_SetNone(PyExc_KeyboardInterrupt); |
Guido van Rossum | abe173a | 1994-06-03 15:58:29 +0000 | [diff] [blame] | 18 | return -1; |
| 19 | } |