[ python-Bugs-1552726 ] Python polls unnecessarily every 0.1 second when interactive

SourceForge.net noreply at sourceforge.net
Tue Sep 5 16:43:46 CEST 2006


Bugs item #1552726, was opened at 2006-09-05 14:42
Message generated for change (Settings changed) made by richardb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1552726&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Richard Boulton (richardb)
Assigned to: Nobody/Anonymous (nobody)
>Summary: Python polls unnecessarily every 0.1 second when interactive

Initial Comment:
When python is running an interactive session, and is
idle, it calls "select" with a timeout of 0.1 seconds
repeatedly.  This is intended to allow PyOS_InputHook()
to be called every 0.1 seconds, but happens even if
PyOS_InputHook() isn't being used (ie, is NULL).

To reproduce:
 - start a python session
 - attach to it using strace -p PID
 - observe that python repeatedly

This isn't a significant problem, since it only affects
idle interactive python sessions and uses only a tiny
bit of CPU, but people are whinging about it (though
some appear to be doing so tongue-in-cheek) and it
would be nice to fix it.

The attached patch (against Python-2.5c1) modifies the
readline.c module so that the polling doesn't happen
unless PyOS_InputHook is not NULL.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1552726&group_id=5470


More information about the Python-bugs-list mailing list