Patches item #1190163, was opened at 2005-04-26 05:50
Message generated for change (Comment added) made by kbk
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1190163&group_id=5470
Category: IDLE
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Michiel de Hoon (mdehoon)
Assigned to: Kurt B. Kaiser (kbk)
Summary: Minimal cleanup of run.py
Initial Comment:
In the main function in run.py in Lib/idlelib, we have
try:
seq, request = rpc.request_queue.get(0)
except Queue.Empty:
time.sleep(0.05)
continue
The get method of rpc.request_queue already has the
option of a timeout, so we can use that instead of
inlining time.sleep:
try:
seq, request = rpc.request_queue.get(block=True,
timeout=0.05)
except Queue.Empty:
continue
resulting in a (small) simplication of the code. The
patch was tested on Windows, Linux, and Mac OS X.
In case you are wondering why I care about this:
My real interest is in PyOS_InputHook, a pointer to a
function which is called ten times per second when
Python is idle (e.g., waiting for user input).
Currently, calls to PyOS_InputHook are missing in some
cases where Python goes idle. I am going through the
code to fix this. Now, since both the original code in
run.py and rpc.request_queue.get cause Python to go
idle (by calling the sleep function), it means that I
would have to fix both cases. By making use of the
existing code in rpc.request_queue.get, I need to fix
this routine only (which I will do in a later patch),
and avoids having calls to PyOS_InputHook all over the
place.
----------------------------------------------------------------------
>Comment By: Kurt B. Kaiser (kbk)
Date: 2005-05-05 18:30
Message:
Logged In: YES
user_id=149084
run.py rev 1.32
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1190163&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches