diff options
author | Michael W. Hudson <mwh@python.net> | 2005-04-07 10:11:19 +0000 |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2005-04-07 10:11:19 +0000 |
commit | 103a672a7c8c22bff00bb690c683d96acef1229f (patch) | |
tree | 0d2a3bc99bcc230f41b000a61205c7fb5e271373 /Modules | |
parent | ceb822f04c7c4f93d22103ffff3661454f2aad34 (diff) | |
download | cpython-103a672a7c8c22bff00bb690c683d96acef1229f.tar.gz |
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')
-rw-r--r-- | Modules/readline.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 7802625611..25a43b2341 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(); |