summaryrefslogtreecommitdiffstats
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-04-07 10:11:19 (GMT)
committerMichael W. Hudson <mwh@python.net>2005-04-07 10:11:19 (GMT)
commite3afc598bc62c6ad46c56feec3f18cf8131c91c6 (patch)
treea9aa0012c005163c8925db55f1a136ffd1c9b8de /Modules/readline.c
parentad351f806d74d8ffbfd8b8f8f78b72043d9c8168 (diff)
downloadcpython-e3afc598bc62c6ad46c56feec3f18cf8131c91c6.zip
cpython-e3afc598bc62c6ad46c56feec3f18cf8131c91c6.tar.gz
cpython-e3afc598bc62c6ad46c56feec3f18cf8131c91c6.tar.bz2
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! Backport candidate.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r--Modules/readline.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 7802625..25a43b2 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -775,9 +775,13 @@ readline_until_enter_or_signal(char *prompt, int *signal)
}
else 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) {
rl_free_line_state();
rl_cleanup_after_signal();