Staging
v0.5.1
https://github.com/python/cpython
Revision 7da7a01f9949f625f29960883b001af44d54402a authored by Miss Islington (bot) on 30 May 2018, 23:35:15 UTC, committed by Yury Selivanov on 30 May 2018, 23:35:15 UTC
(cherry picked from commit 495e567a2b3bbe3b99f0c253edf12997a9ff4ee1)

Co-authored-by: Dmitry Shachnev <mitya57@users.noreply.github.com>
1 parent 7301dd9
Raw File
Tip revision: 7da7a01f9949f625f29960883b001af44d54402a authored by Miss Islington (bot) on 30 May 2018, 23:35:15 UTC
3.6 what's new: fix a reference to PEP 528 (GH-7113) (#7257)
Tip revision: 7da7a01
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