[Patches] [ python-Patches-1049855 ] PyOS_InputHook inconsistency on Windows

SourceForge.net noreply at sourceforge.net
Sat Apr 30 20:21:49 CEST 2005


Patches item #1049855, was opened at 2004-10-19 04:03
Message generated for change (Comment added) made by kbk
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1049855&group_id=5470

Category: IDLE
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Michiel de Hoon (mdehoon)
>Assigned to: Nobody/Anonymous (nobody)
Summary: PyOS_InputHook inconsistency on Windows

Initial Comment:
PyOS_InputHook is a pointer to a function to be called
periodically when Python is idle. It is used, for
example, to get messages delivered to graphics windows.
If I compile Python from source (which uses
Modules/readline.c), PyOS_InputHook is called ten times
per second. However, with the Windows-version of
Python, PyOS_InputHook is called only once for each
command typed by the user. It seems that the problem
resides in Parser/myreadline.c (which I presume is used
for the Windows-version of Python):

if (PyOS_InputHook != NULL)
       (void)(PyOS_InputHook)();
...
p = fgets(buf, len, fp);

Python idles at "fgets", but PyOS_InputHook is not
being called while Python is idle.

The attached patch solves this problem by using the
"select" function, basically in the same way as what is
in Module/readline.c. I don't know how to compile
Python for Windows, so I wasn't able to test this patch.

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

>Comment By: Kurt B. Kaiser (kbk)
Date: 2005-04-30 13:21

Message:
Logged In: YES 
user_id=149084

The revised patch looks ok to me.

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

Comment By: Michiel de Hoon (mdehoon)
Date: 2005-03-26 08:33

Message:
Logged In: YES 
user_id=488897

I have now tested this patch. After fixing one error (I had
forgotton to declare one variable), the patch works
correctly. I have uploaded a fixed patch.
Note that this bug occurs not only on Windows, but on any
Python compiled without readline. (which allowed me to test
this patch by compiling Python without readline support).

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

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


More information about the Patches mailing list