Mercurial > cpython-lru_cache-weakref
annotate Parser/intrcheck.c @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | 1c9a84e0981d |
| children | 08b1e9d847e6 |
| rev | line source |
|---|---|
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
1 /*********************************************************** |
|
2060
146890653a57
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
1907
diff
changeset
|
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
|
146890653a57
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
1907
diff
changeset
|
3 The Netherlands. |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
4 |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
5 All Rights Reserved |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
6 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
7 Permission to use, copy, modify, and distribute this software and its |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
8 documentation for any purpose and without fee is hereby granted, |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
9 provided that the above copyright notice appear in all copies and that |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
10 both that copyright notice and this permission notice appear in |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
11 supporting documentation, and that the names of Stichting Mathematisch |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
12 Centrum or CWI or Corporation for National Research Initiatives or |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
13 CNRI not be used in advertising or publicity pertaining to |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
14 distribution of the software without specific, written prior |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
15 permission. |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
16 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
17 While CWI is the initial source for this software, a modified version |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
18 is made available by the Corporation for National Research Initiatives |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
19 (CNRI) at the Internet address ftp://ftp.python.org. |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
20 |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4043
diff
changeset
|
28 PERFORMANCE OF THIS SOFTWARE. |
|
145
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
29 |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
30 ******************************************************************/ |
|
853b736a6a9e
Added copyright notice.
Guido van Rossum <guido@python.org>
parents:
113
diff
changeset
|
31 |
| 6 | 32 /* Check for interrupts */ |
| 33 | |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
34 #include "config.h" |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
35 #include "myproto.h" |
|
5114
b9ce3cc50076
Added decl for Py_AddPendingCall and include mymalloc.h, all to keep
Guido van Rossum <guido@python.org>
parents:
5019
diff
changeset
|
36 #include "mymalloc.h" /* For ANY */ |
| 611 | 37 #include "intrcheck.h" |
| 38 | |
|
5114
b9ce3cc50076
Added decl for Py_AddPendingCall and include mymalloc.h, all to keep
Guido van Rossum <guido@python.org>
parents:
5019
diff
changeset
|
39 /* Copied here from ceval.h -- can't include that file. */ |
|
b9ce3cc50076
Added decl for Py_AddPendingCall and include mymalloc.h, all to keep
Guido van Rossum <guido@python.org>
parents:
5019
diff
changeset
|
40 int Py_AddPendingCall Py_PROTO((int (*func) Py_PROTO((ANY *)), ANY *arg)); |
|
b9ce3cc50076
Added decl for Py_AddPendingCall and include mymalloc.h, all to keep
Guido van Rossum <guido@python.org>
parents:
5019
diff
changeset
|
41 |
|
293
f900b692b37e
Generalize to macintosh.
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
42 |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
43 #ifdef QUICKWIN |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
44 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
45 #include <io.h> |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
46 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
47 void |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
48 PyOS_InitInterrupts() |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
49 { |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
50 } |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
51 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
52 int |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
53 PyOS_InterruptOccurred() |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
54 { |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
55 _wyield(); |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
56 } |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
57 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
58 #define OK |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
59 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
60 #endif /* QUICKWIN */ |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
61 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
62 #ifdef _M_IX86 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
63 #include <io.h> |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
64 #endif |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
65 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
66 #if defined(MSDOS) && !defined(QUICKWIN) |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
67 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
68 #ifdef __GNUC__ |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
69 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
70 /* This is for DJGPP's GO32 extender. I don't know how to trap |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
71 * control-C (There's no API for ctrl-C, and I don't want to mess with |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
72 * the interrupt vectors.) However, this DOES catch control-break. |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
73 * --Amrit |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
74 */ |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
75 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
76 #include <go32.h> |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
77 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
78 void |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
79 PyOS_InitInterrupts() |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
80 { |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
81 _go32_want_ctrl_break(1 /* TRUE */); |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
82 } |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
83 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
84 int |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
85 PyOS_InterruptOccurred() |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
86 { |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
87 return _go32_was_ctrl_break_hit(); |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
88 } |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
89 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
90 #else /* !__GNUC__ */ |
| 6 | 91 |
| 86 | 92 /* This might work for MS-DOS (untested though): */ |
| 6 | 93 |
| 94 void | |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
95 PyOS_InitInterrupts() |
| 6 | 96 { |
| 97 } | |
| 98 | |
| 99 int | |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
100 PyOS_InterruptOccurred() |
| 6 | 101 { |
| 102 int interrupted = 0; | |
| 103 while (kbhit()) { | |
| 104 if (getch() == '\003') | |
| 105 interrupted = 1; | |
| 106 } | |
| 107 return interrupted; | |
| 108 } | |
| 109 | |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
110 #endif /* __GNUC__ */ |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
111 |
| 6 | 112 #define OK |
| 113 | |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
114 #endif /* MSDOS && !QUICKWIN */ |
| 6 | 115 |
| 116 | |
|
293
f900b692b37e
Generalize to macintosh.
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
117 #ifdef macintosh |
|
f900b692b37e
Generalize to macintosh.
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
118 |
|
2261
645e96343f89
Mac interrupt code moved to macglue.c
Jack Jansen <jack.jansen@cwi.nl>
parents:
2248
diff
changeset
|
119 /* The Mac interrupt code has moved to macglue.c */ |
| 6 | 120 #define OK |
| 121 | |
|
293
f900b692b37e
Generalize to macintosh.
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
122 #endif /* macintosh */ |
| 6 | 123 |
| 124 | |
| 125 #ifndef OK | |
| 126 | |
| 86 | 127 /* Default version -- for real operating systems and for Standard C */ |
| 6 | 128 |
| 129 #include <stdio.h> | |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
130 #include <string.h> |
| 6 | 131 #include <signal.h> |
| 4577 | 132 #ifdef HAVE_UNISTD_H |
| 133 #include <unistd.h> | |
| 134 #endif | |
| 6 | 135 |
|
2148
f99a23998770
made interrupted static again
Guido van Rossum <guido@python.org>
parents:
2060
diff
changeset
|
136 static int interrupted; |
| 6 | 137 |
|
2520
847d24841c85
added PyErr_SetInterrupt()
Guido van Rossum <guido@python.org>
parents:
2272
diff
changeset
|
138 void |
|
847d24841c85
added PyErr_SetInterrupt()
Guido van Rossum <guido@python.org>
parents:
2272
diff
changeset
|
139 PyErr_SetInterrupt() |
|
847d24841c85
added PyErr_SetInterrupt()
Guido van Rossum <guido@python.org>
parents:
2272
diff
changeset
|
140 { |
|
847d24841c85
added PyErr_SetInterrupt()
Guido van Rossum <guido@python.org>
parents:
2272
diff
changeset
|
141 interrupted = 1; |
|
847d24841c85
added PyErr_SetInterrupt()
Guido van Rossum <guido@python.org>
parents:
2272
diff
changeset
|
142 } |
|
847d24841c85
added PyErr_SetInterrupt()
Guido van Rossum <guido@python.org>
parents:
2272
diff
changeset
|
143 |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
144 extern int PyErr_CheckSignals(); |
|
5019
28935609dfae
In the Unix version, arrange for sigcheck() to be called via
Guido van Rossum <guido@python.org>
parents:
4577
diff
changeset
|
145 |
| 748 | 146 /* ARGSUSED */ |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
147 static RETSIGTYPE |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
148 #ifdef _M_IX86 |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
149 intcatcher(int sig) /* So the C compiler shuts up */ |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
150 #else /* _M_IX86 */ |
| 6 | 151 intcatcher(sig) |
| 748 | 152 int sig; /* Not used by required by interface */ |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
153 #endif /* _M_IX86 */ |
| 6 | 154 { |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
155 extern void Py_Exit Py_PROTO((int)); |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
156 static char message[] = |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
157 "python: to interrupt a truly hanging Python program, interrupt once more.\n"; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
158 switch (interrupted++) { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
159 case 0: |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
160 break; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
161 case 1: |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
162 write(2, message, strlen(message)); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
163 break; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
164 case 2: |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
165 interrupted = 0; |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
166 Py_Exit(1); |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
167 break; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1273
diff
changeset
|
168 } |
| 6 | 169 signal(SIGINT, intcatcher); |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
170 Py_AddPendingCall(PyErr_CheckSignals, NULL); |
| 6 | 171 } |
| 172 | |
| 173 void | |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
174 PyOS_InitInterrupts() |
| 6 | 175 { |
| 176 if (signal(SIGINT, SIG_IGN) != SIG_IGN) | |
| 177 signal(SIGINT, intcatcher); | |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
178 #ifdef HAVE_SIGINTERRUPT |
|
1273
69a066b6b1ff
(I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
179 /* This is for SunOS and other modern BSD derivatives. |
|
69a066b6b1ff
(I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
180 It means that system calls (like read()) are not restarted |
|
69a066b6b1ff
(I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
181 after an interrupt. This is necessary so interrupting a |
|
69a066b6b1ff
(I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
182 read() or readline() call works as expected. |
|
69a066b6b1ff
(I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
183 XXX On old BSD (pure 4.2 or older) you may have to do this |
|
69a066b6b1ff
(I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
184 differently! */ |
|
69a066b6b1ff
(I suggest a recompile after getting this, the ceval.c bugfix may be crucial!)
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
185 siginterrupt(SIGINT, 1); |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
186 #endif /* HAVE_SIGINTERRUPT */ |
| 6 | 187 } |
| 188 | |
| 189 int | |
|
5379
1c9a84e0981d
Another directory quickly renamed.
Guido van Rossum <guido@python.org>
parents:
5114
diff
changeset
|
190 PyOS_InterruptOccurred() |
| 6 | 191 { |
| 192 if (!interrupted) | |
| 193 return 0; | |
| 194 interrupted = 0; | |
| 195 return 1; | |
| 196 } | |
| 197 | |
| 198 #endif /* !OK */ |
