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 "
Marian Beermann added the comment:
Indeed, os.posix_fadvise tries to fetch the error from errno, via posix_error()
static PyObject *
os_posix_fadvise_impl(PyObject *module, int fd, Py_off_t offset,
Py_off_t length, int advice)
/*[clinic end generated code: output
New submission from Marian Beermann:
The use of os.listdir severely limits the speed of this function on
anything except solid-state drives.
Using the new-in-Python 3.5 os.scandir should eliminate this
bottleneck.
--
components: Library (Lib)
messages: 279745
nosy: enkore
priority
Marian Beermann added the comment:
The main issue on *nix is more likely that by using listdir you get directory
order, while what you really need is inode ordering. scandir allows for that,
since you get the inode from the DirEntry with no extra syscalls - especially
without an open() or