classification
Title: PyOS_InputHook not called in IDLE subprocess
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: kbk Nosy List: BreamoreBoy, gpolo, kbk, mdehoon, serwy
Priority: normal Keywords:

Created on 2004-10-25 12:31 by mdehoon, last changed 2011-10-18 18:25 by serwy.

Messages (3)
msg22850 - (view) Author: Michiel de Hoon (mdehoon) Date: 2004-10-25 12:31
PyOS_InputHook is a variable points to a user-defined
function (e.g. in an extension module) that is to be
called periodically when Python is idle (e.g. waiting
for user input). It is used for example by Tkinter to
get messages delivered to the graphics window. For
Python run from the command prompt, PyOS_InputHook (if
not NULL) is called ten times per second.

In IDLE, when a subprocess is being used (so the
default behavior), the main process and the subprocess
each have their own PyOS_InputHook. The problem is that
the subprocess (the one that runs the user's commands)
does not call PyOS_InputHook.

So if a user (in IDLE) imports an extension module that
sets PyOS_InputHook, the extension module will not run
correctly as PyOS_InputHook is being ignored.

The solution to this problem is probably quite simple,
maybe just a line

if (PyOS_InputHook) PyOS_InputHook();

but I am not familiar enough with threads to be able to
figure out what the best location for such a line would
be. I tried putting it inside the loop in
PyEval_EvalFrame in Python/ceval.c, which solved the
problem on some platforms but not on others.

--Michiel.
msg109741 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-07-09 14:07
Wuld anyone with the relevant expertise care to comment on this please?
msg145851 - (view) Author: Roger Serwy (serwy) * Date: 2011-10-18 18:25
This is related to http://bugs.python.org/issue989712
History
Date User Action Args
2011-10-18 18:25:51serwysetnosy: + serwy
messages: + msg145851
2010-08-19 17:56:33BreamoreBoysetnosy: + gpolo
2010-07-09 14:07:57BreamoreBoysetnosy: + BreamoreBoy
title: PyOS_InputHook not called in subprocess -> PyOS_InputHook not called in IDLE subprocess
messages: + msg109741

versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
2009-02-14 18:19:12ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6, - Python 2.5
2004-10-25 12:31:42mdehooncreate