_make_boundary(): Fix for SF bug #745478, broken boundary calculation
[python/dscho.git] / Lib / idlelib / interruptmodule.c
blob8e18d5af906d0c460491ca643bb7996741ba30c1
1 /***********************************************************************
2 * interruptmodule.c
4 * Python extension implementing the interrupt module.
5 *
6 **********************************************************************/
8 #include "Python.h"
10 #ifndef PyDoc_STR
11 #define PyDoc_VAR(name) static char name[]
12 #define PyDoc_STR(str) str
13 #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
14 #endif
16 /* module documentation */
18 PyDoc_STRVAR(module_doc,
19 "Provide a way to interrupt the main thread from a subthread.\n\n\
20 In threaded Python code the KeyboardInterrupt is always directed to\n\
21 the thread which raised it. This extension provides a method,\n\
22 interrupt_main, which a subthread can use to raise a KeyboardInterrupt\n\
23 in the main thread.");
25 /* module functions */
27 static PyObject *
28 setinterrupt(PyObject * self, PyObject * args)
30 PyErr_SetInterrupt();
31 Py_INCREF(Py_None);
32 return Py_None;
35 /* registration table */
37 static struct PyMethodDef methods[] = {
38 {"interrupt_main", setinterrupt, METH_VARARGS,
39 PyDoc_STR("Interrupt the main thread")},
40 {NULL, NULL}
43 /* module initialization */
45 void
46 initinterrupt(void)
48 (void) Py_InitModule3("interrupt", methods, module_doc);