/Python/sigcheck.c

http://unladen-swallow.googlecode.com/ · C · 19 lines · 9 code · 3 blank · 7 comment · 1 complexity · 66d32a096a3ae08040476c1a8cd1097c MD5 · raw file

  1. /* Sigcheck is similar to intrcheck() but sets an exception when an
  2. interrupt occurs. It can't be in the intrcheck.c file since that
  3. file (and the whole directory it is in) doesn't know about objects
  4. or exceptions. It can't be in errors.c because it can be
  5. overridden (at link time) by a more powerful version implemented in
  6. signalmodule.c. */
  7. #include "Python.h"
  8. /* ARGSUSED */
  9. int
  10. PyErr_CheckSignals(void)
  11. {
  12. if (!PyOS_InterruptOccurred())
  13. return 0;
  14. PyErr_SetNone(PyExc_KeyboardInterrupt);
  15. return -1;
  16. }