Bugs item #1552726, was opened at 2006-09-05 10:42 Message generated for change (Comment added) made by akuchling 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: Closed >Resolution: Fixed Priority: 5 Submitted By: Richard Boulton (richardb) >Assigned to: A.M. Kuchling (akuchling) 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. ---------------------------------------------------------------------- >Comment By: A.M. Kuchling (akuchling) Date: 2006-09-07 10:02 Message: Logged In: YES user_id=11375 Recent versions of readline can still support callbacks if READLINE_CALLBACK is defined, so I could test the patch by running 'CFLAGS=-DREADLINE_CALLBACK' and re-running configure. Applied as rev. 51815 to the trunk, so the fix will be in Python 2.6. The 2.5 release manager needs to decide if it should be applied to the 2.5 branch. ---------------------------------------------------------------------- Comment By: A.M. Kuchling (akuchling) Date: 2006-09-07 09:24 Message: Logged In: YES user_id=11375 Original report: http://perkypants.org/blog/2006/09/02/rfte-python This is tied to the version of readline being used; the select code is only used if HAVE_RL_CALLBACK is defined, and a comment in Python's configure.in claims it's only defined with readline 2.1. Current versions of readline are 4.3 and 5.1; are people still using such an ancient version of readline? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1552726&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com