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.

Author enkore
Recipients enkore
Date 2017-01-22.11:24:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485084281.16.0.0429055212746.issue29342@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-01-22 11:24:41enkoresetrecipients: + enkore
2017-01-22 11:24:41enkoresetmessageid: <1485084281.16.0.0429055212746.issue29342@psf.upfronthosting.co.za>
2017-01-22 11:24:41enkorelinkissue29342 messages
2017-01-22 11:24:40enkorecreate