Message286003
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=412ef4aa70c98642 input=0fbe554edc2f04b5]*/
{
int result;
int async_err = 0;
do {
Py_BEGIN_ALLOW_THREADS
result = posix_fadvise(fd, offset, length, advice);
Py_END_ALLOW_THREADS
} while (result != 0 && errno == EINTR &&
!(async_err = PyErr_CheckSignals()));
if (result != 0)
return (!async_err) ? posix_error() : NULL;
Py_RETURN_NONE;
}
------------------------------^ posix_error() using errno not result
posix_fallocate has the same caveat and mishandles errors as well:
static PyObject *
os_posix_fallocate_impl(PyObject *module, int fd, Py_off_t offset,
Py_off_t length)
/*[clinic end generated code: output=73f107139564aa9d input=d7a2ef0ab2ca52fb]*/
{
int result;
int async_err = 0;
do {
Py_BEGIN_ALLOW_THREADS
result = posix_fallocate(fd, offset, length);
Py_END_ALLOW_THREADS
} while (result != 0 && errno == EINTR &&
!(async_err = PyErr_CheckSignals()));
if (result != 0)
return (!async_err) ? posix_error() : NULL;
Py_RETURN_NONE;
}
------------------------------^ posix_error() using errno not result |
|
Date |
User |
Action |
Args |
2017-01-22 11:24:41 | enkore | set | recipients:
+ enkore |
2017-01-22 11:24:41 | enkore | set | messageid: <1485084281.16.0.0429055212746.issue29342@psf.upfronthosting.co.za> |
2017-01-22 11:24:41 | enkore | link | issue29342 messages |
2017-01-22 11:24:40 | enkore | create | |
|