blob: dba4bfb913ff1d50eb8bb99806776cb61c04ff19 [file] [log] [blame]
Guido van Rossumabe173a1994-06-03 15:58:29 +00001/***********************************************************
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00002Copyright (c) 2000, BeOpen.com.
3Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5All rights reserved.
Guido van Rossumabe173a1994-06-03 15:58:29 +00006
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00007See the file "Misc/COPYRIGHT" for information on usage and
8redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumabe173a1994-06-03 15:58:29 +00009******************************************************************/
10
11/* Sigcheck is similar to intrcheck() but sets an exception when an
12 interrupt occurs. It can't be in the intrcheck.c file since that
13 file (and the whole directory it is in) doesn't know about objects
14 or exceptions. It can't be in errors.c because it can be
15 overridden (at link time) by a more powerful version implemented in
16 signalmodule.c. */
17
Guido van Rossum79f25d91997-04-29 20:08:16 +000018#include "Python.h"
Guido van Rossumabe173a1994-06-03 15:58:29 +000019
20/* ARGSUSED */
21int
Thomas Woutersf70ef4f2000-07-22 18:47:25 +000022PyErr_CheckSignals(void)
Guido van Rossumabe173a1994-06-03 15:58:29 +000023{
Guido van Rossum79f25d91997-04-29 20:08:16 +000024 if (!PyOS_InterruptOccurred())
Guido van Rossumabe173a1994-06-03 15:58:29 +000025 return 0;
Guido van Rossum79f25d91997-04-29 20:08:16 +000026 PyErr_SetNone(PyExc_KeyboardInterrupt);
Guido van Rossumabe173a1994-06-03 15:58:29 +000027 return -1;
28}