]> granicus.if.org Git - python/commitdiff
[Bug #1552726] Avoid unnecessary polling at the interpreter prompt when certain versi...
authorAndrew M. Kuchling <amk@amk.ca>
Mon, 22 Jan 2007 16:10:27 +0000 (16:10 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Mon, 22 Jan 2007 16:10:27 +0000 (16:10 +0000)
Misc/NEWS
Modules/readline.c

index eeab829d0f332ae298537d74a48fd3a61fbfd110..9876af9c9398061bab9839a715c329b6e78382e8 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -139,6 +139,8 @@ Extension Modules
 - 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
 -------
index 92f2d1f15f35f3e9ab521b5c0c4bb8fb3db1ffb6..853874be2506e78b65bcab6a970542a2d9dc80ad 100644 (file)
@@ -768,10 +768,16 @@ readline_until_enter_or_signal(char *prompt, int *signal)
 
                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();
                }