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.

classification
Title: os.readv() and os.writev() don't raise an OSError on readv()/writev() failure
Type: Stage:
Components: Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, rosslagerwall, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2014-01-03 11:19 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
readv_writev.patch vstinner, 2014-01-03 11:21 review
Messages (4)
msg207220 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-01-03 11:19
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.
msg207221 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-01-03 11:21
os.readv() and os.writev() were added in Python 3.3 with the issue #10812.
msg207687 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-08 14:36
New changeset 1437f499024d by Victor Stinner in branch '3.3':
Issue #20113: os.readv() and os.writev() now raise an OSError exception on
http://hg.python.org/cpython/rev/1437f499024d

New changeset cd50efdce294 by Victor Stinner in branch 'default':
(Merge 3.3) Issue #20113: os.readv() and os.writev() now raise an OSError
http://hg.python.org/cpython/rev/cd50efdce294
msg207688 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-08 15:01
New changeset 1993a8ec3f19 by Victor Stinner in branch '3.3':
Issue #20113: Fix test_posix on OpenIndiana
http://hg.python.org/cpython/rev/1993a8ec3f19

New changeset f1f707dd7cae by Victor Stinner in branch 'default':
(Merge 3.3) Issue #20113: Fix test_posix on OpenIndiana
http://hg.python.org/cpython/rev/f1f707dd7cae
History
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64312
2014-01-08 15:01:53python-devsetmessages: + msg207688
2014-01-08 14:39:30vstinnersetstatus: open -> closed
resolution: fixed
2014-01-08 14:36:11python-devsetnosy: + python-dev
messages: + msg207687
2014-01-03 13:14:41pitrousetnosy: + rosslagerwall
2014-01-03 11:21:21vstinnersetfiles: + readv_writev.patch

nosy: + serhiy.storchaka
messages: + msg207221

keywords: + patch
2014-01-03 11:19:28vstinnercreate