summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-04-07 10:19:47 (GMT)
committerMichael W. Hudson <mwh@python.net>2005-04-07 10:19:47 (GMT)
commit52cba65d1a720a7062660b0d98b04fd3212a6aff (patch)
tree7ec3966f165a8892562c6b08996f8bc652f46bed /Parser
parentb3509dbe6a7d28fedb82c0a892a84391d448e1c7 (diff)
downloadcpython-52cba65d1a720a7062660b0d98b04fd3212a6aff.zip
cpython-52cba65d1a720a7062660b0d98b04fd3212a6aff.tar.gz
cpython-52cba65d1a720a7062660b0d98b04fd3212a6aff.tar.bz2
Backport my recent raw_input() vs no threads build vs SIGINT argh:
In a threads-disabled build, typing Ctrl-C into a raw_input() crashed, because (essentially) I didn't realise that PY_BEGIN/END_ALLOW_THREADS actually expanded to nothing under a no-threads build, so if you somehow NULLed out the threadstate (e.g. by calling PyThread_SaveThread) it would stay NULLed when you return to Python. Argh!
Diffstat (limited to 'Parser')
-rw-r--r--Parser/myreadline.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 7fc421e..a932a87 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -82,9 +82,13 @@ my_fgets(char *buf, int len, FILE *fp)
#ifdef EINTR
if (errno == EINTR) {
int s;
+#ifdef WITH_THREAD
PyEval_RestoreThread(_PyOS_ReadlineTState);
+#endif
s = PyErr_CheckSignals();
+#ifdef WITH_THREAD
PyEval_SaveThread();
+#endif
if (s < 0) {
return 1;
}