[Python-checkins] python/dist/src/Modules readline.c,2.83,2.84

mwh at users.sourceforge.net mwh at users.sourceforge.net
Thu Apr 7 12:11:50 CEST 2005


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10399/Modules

Modified Files:
	readline.c 
Log Message:
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.


Index: readline.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v
retrieving revision 2.83
retrieving revision 2.84
diff -u -d -r2.83 -r2.84
--- readline.c	30 Mar 2005 11:21:53 -0000	2.83
+++ readline.c	7 Apr 2005 10:11:17 -0000	2.84
@@ -775,9 +775,13 @@
 		}
 		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();



More information about the Python-checkins mailing list