[Python-checkins] python/dist/src/Parser myreadline.c,2.33,2.34

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


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

Modified Files:
	myreadline.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: myreadline.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Parser/myreadline.c,v
retrieving revision 2.33
retrieving revision 2.34
diff -u -d -r2.33 -r2.34
--- myreadline.c	8 Jul 2004 15:28:26 -0000	2.33
+++ myreadline.c	7 Apr 2005 10:11:18 -0000	2.34
@@ -82,9 +82,13 @@
 #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;
 			}



More information about the Python-checkins mailing list