Ronald Oussoren added the comment:
This is likely a platform bug, it fails with os.write as well. Interestingly
enough file.write works fine on Python 2.7 (which uses stdio), that appearently
works around this kernel misfeature.
A possible partial workaround is recognise this error in the implementation of
os.write and then perform a partial write. Problem is: while write(2) is
documented as possibly writing less data than expected most users writing to
normal files (as opposed to sockets) probably don’t expect that behavior. On
the other hand, os.write already limits writes to INT_MAX on Windows (see
_Py_write in Python/fileutils.c)
Because of this I’m in favour of adding a simular workaround on OSX (and can
provide a patch).
BTW. the manpage for write says that writev(2) might fail with EINVAL:
[EINVAL] The sum of the iov_len values in the iov array over-
flows a 32-bit integer.
I wouldn’t be surprised if write(2) is implemented using writev(2) and that
this explains the problem.
> On 18 Jul 2015, at 06:05, Serhiy Storchaka <[email protected]> wrote:
>
>
> Changes by Serhiy Storchaka <[email protected]>:
>
>
> ----------
> components: +Extension Modules, IO -Interpreter Core
> nosy: +haypo, ned.deily, ronaldoussoren
>
> _______________________________________
> Python tracker <[email protected]>
> <http://bugs.python.org/issue24658>
> _______________________________________
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24658>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com