[New-bugs-announce] [issue20113] os.readv() and os.writev() don't raise an OSError on readv()/writev() failure

STINNER Victor report at bugs.python.org
Fri Jan 3 12:19:28 CET 2014


New submission from STINNER Victor:

Example:

$ python3
Python 3.3.2 (default, Nov  8 2013, 13:38:57) 
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.fstat(19)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 9] Bad file descriptor
>>> buf=bytearray(10)
>>> os.readv(19, [buf])
-1

I would expect an OSError on os.readv() instead of -1.

Moreover, empty list of buffers are not handled correctly:

$ python3
Python 3.3.2 (default, Nov  8 2013, 13:38:57) 
[GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.readv(0, [])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: error return without exception set

Attached patch should fix both issues.

----------
messages: 207220
nosy: haypo
priority: normal
severity: normal
status: open
title: os.readv() and os.writev() don't raise an OSError on readv()/writev() failure
versions: Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list