[Python-checkins] python/dist/src/Modules readline.c, 2.79.2.2, 2.79.2.3

mwh at users.sourceforge.net mwh at users.sourceforge.net
Thu Apr 7 12:20:19 CEST 2005


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

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



Index: readline.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v
retrieving revision 2.79.2.2
retrieving revision 2.79.2.3
diff -u -d -r2.79.2.2 -r2.79.2.3
--- readline.c	31 Mar 2005 10:20:33 -0000	2.79.2.2
+++ readline.c	7 Apr 2005 10:19:45 -0000	2.79.2.3
@@ -777,9 +777,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