[issue12268] file readline, readlines & readall methods can lose data on EINTR

Gregory P. Smith report at bugs.python.org
Fri Feb 1 22:19:52 CET 2013


Gregory P. Smith added the comment:

it was easier to just take care of auditing the write calls as part of this given the code change was directly related to it.

On Python 2.7 most of the write calls in the builtin file object (Objects/fileobject.c) rather than the new io module use the libc fwrite() call which, in linux man pages at least, is non-specific about what happens on EINTR (does it retry internally or does it return the number of bytes written so far?).  Those could well abort leading to an error.

Setting up a testcase fo to confirm that with is painful (time consuming) so I can't claim the non io module based write's do not still have an EINTR issue on 2.7.

Workaround: Use the io module instead of the builtin open() or file() calls in Python 2.7.

If someone can confirm that with a test case, it'd make another good issue to open.

As for the writev comment... go ahead. :)

----------

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


More information about the Python-bugs-list mailing list