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 ronaldoussoren
Recipients lebigot, ned.deily, ronaldoussoren, vstinner
Date 2015-07-20.12:18:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <5F0B92E8-D269-480E-9510-94B5780261F0@mac.com>
In-reply-to <1437192313.04.0.432492546975.issue24658@psf.upfronthosting.co.za>
Content
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 <report@bugs.python.org> wrote:
> 
> 
> Changes by Serhiy Storchaka <storchaka@gmail.com>:
> 
> 
> ----------
> components: +Extension Modules, IO -Interpreter Core
> nosy: +haypo, ned.deily, ronaldoussoren
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue24658>
> _______________________________________
History
Date User Action Args
2015-07-20 12:19:00ronaldoussorensetrecipients: + ronaldoussoren, vstinner, lebigot, ned.deily
2015-07-20 12:19:00ronaldoussorenlinkissue24658 messages
2015-07-20 12:18:59ronaldoussorencreate