blob: 8e949a04d4d30e8c1773430f26048968a3802765 [file] [log] [blame]
Guido van Rossumabe173a1994-06-03 15:58:29 +00001/***********************************************************
Guido van Rossum6d023c91995-01-04 19:12:13 +00002Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3The Netherlands.
Guido van Rossumabe173a1994-06-03 15:58:29 +00004
5 All Rights Reserved
6
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00007Copyright (c) 2000, BeOpen.com.
8Copyright (c) 1995-2000, Corporation for National Research Initiatives.
9Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
10All rights reserved.
Guido van Rossumabe173a1994-06-03 15:58:29 +000011
Guido van Rossumfd71b9e2000-06-30 23:50:40 +000012See the file "Misc/COPYRIGHT" for information on usage and
13redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumabe173a1994-06-03 15:58:29 +000014
15******************************************************************/
16
17/* Sigcheck is similar to intrcheck() but sets an exception when an
18 interrupt occurs. It can't be in the intrcheck.c file since that
19 file (and the whole directory it is in) doesn't know about objects
20 or exceptions. It can't be in errors.c because it can be
21 overridden (at link time) by a more powerful version implemented in
22 signalmodule.c. */
23
Guido van Rossum79f25d91997-04-29 20:08:16 +000024#include "Python.h"
Guido van Rossumabe173a1994-06-03 15:58:29 +000025
26/* ARGSUSED */
27int
Guido van Rossum79f25d91997-04-29 20:08:16 +000028PyErr_CheckSignals()
Guido van Rossumabe173a1994-06-03 15:58:29 +000029{
Guido van Rossum79f25d91997-04-29 20:08:16 +000030 if (!PyOS_InterruptOccurred())
Guido van Rossumabe173a1994-06-03 15:58:29 +000031 return 0;
Guido van Rossum79f25d91997-04-29 20:08:16 +000032 PyErr_SetNone(PyExc_KeyboardInterrupt);
Guido van Rossumabe173a1994-06-03 15:58:29 +000033 return -1;
34}