[New-bugs-announce] [issue29342] os.posix_fadvise misreports errors

Marian Beermann report at bugs.python.org
Sun Jan 22 06:20:17 EST 2017


New submission from Marian Beermann:

It has been observed that posix_fadvise will not report the original error if the syscall fails. Eg. https://bugs.alpinelinux.org/issues/6592

>>> os.posix_fadvise(-1, 0, 0, os.POSIX_FADV_DONTNEED)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 0] Error

Should report EBADF

>>> os.posix_fadvise(16, 0, 0, os.POSIX_FADV_DONTNEED)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 0] Error

Ditto

>>> os.posix_fadvise(0, 0, 0, 12345)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 0] Error

Should be EINVAL

...

This might be because unlike most syscall wrappers posix_fadvise does not set errno but only returns it.

----------
components: IO, Library (Lib)
messages: 286002
nosy: enkore
priority: normal
severity: normal
status: open
title: os.posix_fadvise misreports errors
versions: Python 3.6

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


More information about the New-bugs-announce mailing list