[issue3180] Interrupts are lost during readline PyOS_InputHook processing

Michael Abbott report at bugs.python.org
Mon Jun 23 18:32:23 CEST 2008


New submission from Michael Abbott <michael at araneidae.co.uk>:

The (undocumented!) API for PyOS_InputHook has two defects which are
addressed in the attached patch (at least when using the readline
module): firstly the called hook currently has to guess that input will
come on descriptor 0; secondly, any Ctrl-C interrupts encountered during
the processing of the input hook are lost.

This loss of interrupts can be rather annoying.  The attached patch
addresses these problems by redefining the API to PyOS_InputHook as 

    int PyOS_InputHook(int file_in);

where file_in is the descriptor to monitor (PyOS_InputHook need not
return until file_in is ready to read), and the return value is non-zero
if and only if processing was interrupted.

Testing for interruption is implemented in the HAVE_RL_CALLBACK and
HAVE_SELECT branch of Modules/readline.c; other uses retain their
original functionality (I believe!).

The attached patch was prepared against
http://svn.python.org/projects/python/trunk , current at the time of
writing.

----------
components: None
files: input-hook.patch
keywords: patch
messages: 68638
nosy: Araneidae
severity: normal
status: open
title: Interrupts are lost during readline PyOS_InputHook processing
type: feature request
versions: Python 2.6
Added file: http://bugs.python.org/file10709/input-hook.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3180>
_______________________________________


More information about the Python-bugs-list mailing list