This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients alanwilter, georg.brandl, neologix, pitrou
Date 2011-01-09.18:36:40
SpamBayes Score 2.0073e-10
Marked as misclassified No
Message-id <>
In-reply-to <>
> Antoine Pitrou <> added the comment:
> Charles-François' analysis seems to be right. Note that the actual issue here is that read() always succeeds, returning a partial result (because you're executing a command, 'find /', which outputs a lot of data). If read() were interrupted before anything could be read, it would return EINTR and the handler would get executed immediately.
> Anyone wants to propose a patch + tests?

Attached is a tentative patch: it checks for pending signals inside
_bufferedreader_read_generic, fileio_readall, and rawiobase_readall.
I tested quickly on regular files and on pipes, and handlers are now
called on time. As a an obvious bonus, it's also easier to interrupt a
script doing I/O with a KeyboardInterrupt (SIGINT).
If nothing seems blatantly wrong about this patch, I will go ahead and
try to write some tests for this.


> ----------
> versions: +Python 3.2
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
File name Uploaded
io_signal.diff neologix, 2011-01-09.18:36:40
Date User Action Args
2011-01-09 18:36:42neologixsetrecipients: + neologix, georg.brandl, pitrou, alanwilter
2011-01-09 18:36:40neologixlinkissue9504 messages
2011-01-09 18:36:40neologixcreate