diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2007-01-22 16:10:27 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2007-01-22 16:10:27 (GMT) |
commit | b8c6e1f33f9364b47af306791b44dba4109afd82 (patch) | |
tree | 80ea5f191263aba2a50b39813153f00bcccbd472 /Modules | |
parent | e69747c630abb153e9a7029f076149650552b0c5 (diff) | |
download | cpython-b8c6e1f33f9364b47af306791b44dba4109afd82.zip cpython-b8c6e1f33f9364b47af306791b44dba4109afd82.tar.gz cpython-b8c6e1f33f9364b47af306791b44dba4109afd82.tar.bz2 |
[Bug #1552726] Avoid unnecessary polling at the interpreter prompt when certain versions of readline are being used
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/readline.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 92f2d1f..853874b 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -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(); } |