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 eryksun
Recipients eryksun, jimbo1qaz_, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-03-22.00:14:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616372058.59.0.237822905314.issue35754@roundup.psfhosted.org>
In-reply-to
Content
It's still the case that we have to guess that a generic EINVAL (22) is actually EPIPE. Low-level wrapper functions in Python/fileutils.c, such as _Py_read() and _Py_write_impl(), should try to get a better error code by calling Python's custom winerror_to_errno() mapping function on the CRT's _doserrno value. For example:

_Py_read:

    #ifdef MS_WINDOWS
            n = read(fd, buf, (int)count);
            if (n < 0 && errno == EINVAL) {
                errno = winerror_to_errno(_doserrno);
            }

_Py_write_impl:

    #ifdef MS_WINDOWS
                n = write(fd, buf, (int)count);
                if (n < 0 && errno == EINVAL) {
                    errno = winerror_to_errno(_doserrno);
                }

This maps ERROR_NO_DATA to EPIPE.
History
Date User Action Args
2021-03-22 00:14:18eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, jimbo1qaz_
2021-03-22 00:14:18eryksunsetmessageid: <1616372058.59.0.237822905314.issue35754@roundup.psfhosted.org>
2021-03-22 00:14:18eryksunlinkissue35754 messages
2021-03-22 00:14:18eryksuncreate