[Python-checkins] r53516 - in python/branches/release25-maint: Misc/NEWS Modules/readline.c

andrew.kuchling python-checkins at python.org
Mon Jan 22 17:10:28 CET 2007


Author: andrew.kuchling
Date: Mon Jan 22 17:10:27 2007
New Revision: 53516

Modified:
   python/branches/release25-maint/Misc/NEWS
   python/branches/release25-maint/Modules/readline.c
Log:
[Bug #1552726] Avoid unnecessary polling at the interpreter prompt when certain versions of readline are being used

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Mon Jan 22 17:10:27 2007
@@ -139,6 +139,8 @@
 - Modifying an empty deque during iteration now raises RuntimeError
   instead of StopIteration.
 
+- Bug #1552726: fix polling at the interpreter prompt when certain
+  versions of the readline library are in use.
 
 Library
 -------

Modified: python/branches/release25-maint/Modules/readline.c
==============================================================================
--- python/branches/release25-maint/Modules/readline.c	(original)
+++ python/branches/release25-maint/Modules/readline.c	Mon Jan 22 17:10:27 2007
@@ -768,10 +768,16 @@
 
 		while (!has_input)
 		{	struct timeval timeout = {0, 100000}; /* 0.1 seconds */
+
+			/* [Bug #1552726] Only limit the pause if an input hook has been 
+			   defined.  */
+		 	struct timeval *timeoutp = NULL;
+			if (PyOS_InputHook) 
+				timeoutp = &timeout;
 			FD_SET(fileno(rl_instream), &selectset);
 			/* select resets selectset if no input was available */
 			has_input = select(fileno(rl_instream) + 1, &selectset,
-					   NULL, NULL, &timeout);
+					   NULL, NULL, timeoutp);
 			if(PyOS_InputHook) PyOS_InputHook();
 		}
 


More information about the Python-checkins mailing list