Staging
v0.5.1
https://github.com/python/cpython
Revision a73399d5963d6b1639d935968f4a8baa868c39d3 authored by Miss Islington (bot) on 11 June 2018, 02:30:57 UTC, committed by Ned Deily on 11 June 2018, 02:30:57 UTC
(cherry picked from commit ef057bfb06cae0718e6d708061649d2e3983e2ef)

Co-authored-by: Ned Deily <nad@python.org>
1 parent ec4343c
Raw File
Tip revision: a73399d5963d6b1639d935968f4a8baa868c39d3 authored by Miss Islington (bot) on 11 June 2018, 02:30:57 UTC
bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609) (GH-7610)
Tip revision: a73399d
generrmap.c
#include <windows.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <errno.h>

/* Extract the mapping of Win32 error codes to errno */

int main()
{
    int i;
    _setmode(fileno(stdout), O_BINARY);
    printf("/* Generated file. Do not edit. */\n");
    printf("int winerror_to_errno(int winerror)\n");
    printf("{\n    switch(winerror) {\n");
    for(i=1; i < 65000; i++) {
        _dosmaperr(i);
        if (errno == EINVAL) {
            /* Issue #12802 */
            if (i == ERROR_DIRECTORY)
                errno = ENOTDIR;
            /* Issue #13063 */
            else if (i == ERROR_NO_DATA)
                errno = EPIPE;
            else
                continue;
        }
        printf("        case %d: return %d;\n", i, errno);
    }
    printf("        default: return EINVAL;\n");
    printf("    }\n}\n");
}
back to top