blob: 022d0e8ac39016512901e5bb2adbfde259612efe [file] [log] [blame]
Guido van Rossumabe173a1994-06-03 15:58:29 +00001
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 Rossum79f25d91997-04-29 20:08:16 +00009#include "Python.h"
Guido van Rossumabe173a1994-06-03 15:58:29 +000010
11/* ARGSUSED */
12int
Thomas Woutersf70ef4f2000-07-22 18:47:25 +000013PyErr_CheckSignals(void)
Guido van Rossumabe173a1994-06-03 15:58:29 +000014{
Guido van Rossum79f25d91997-04-29 20:08:16 +000015 if (!PyOS_InterruptOccurred())
Guido van Rossumabe173a1994-06-03 15:58:29 +000016 return 0;
Guido van Rossum79f25d91997-04-29 20:08:16 +000017 PyErr_SetNone(PyExc_KeyboardInterrupt);
Guido van Rossumabe173a1994-06-03 15:58:29 +000018 return -1;
19}