[ python-Bugs-1030629 ] PyOS_InputHook broken

SourceForge.net noreply at sourceforge.net
Thu Oct 7 13:20:21 CEST 2004


Bugs item #1030629, was opened at 2004-09-19 11:27
Message generated for change (Comment added) made by mwh
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1030629&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Michiel de Hoon (mdehoon)
Assigned to: Michael Hudson (mwh)
Summary: PyOS_InputHook broken

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.
In Python 2.3.4, calling PyOS_InputHook was handled by
readline via

rl_event_hook = PyOS_InputHook;
...   
p = readline(prompt);

The readline library takes care of calling
rl_event_hook (and hence PyOS_InputHook) ten times per
second while Python idles at the call to readline(prompt).

In Python 2.4a3, the call to readline is replaced by a
call to readline_until_enter_or_signal. Here, the
"select" function is used:

has_input = select(fileno(rl_instream) + 1, &selectset,
                                   NULL, NULL, NULL);
if(has_input > 0) {
                        rl_callback_read_char();
}

Now Python idles at "select", but PyOS_InputHook is not
being called. Instead, PyOS_InputHook gets called via
rl_event_hook at rl_callback_read_char. This means that
PyOS_InputHook is called once for every character the
user types, and is not called at all if the user is not
typing something.

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

>Comment By: Michael Hudson (mwh)
Date: 2004-10-07 12:20

Message:
Logged In: YES 
user_id=6656

er, ping?  i'm willing to believe this is a fairly bad bug, but i could 
do with some encouragement to fix it :-)

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

Comment By: Michael Hudson (mwh)
Date: 2004-09-19 19:35

Message:
Logged In: YES 
user_id=6656

Well, this is probably my fault.  However, I'm about to go on 
holiday for a week and thinking about readline is definitely not 
part of my plans :-)

Can you work up a patch for this?  It shouldn't be terribly hard -- a 
non-NULL fifth argument to select seems in order.

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

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


More information about the Python-bugs-list mailing list