Staging
v0.5.1
https://github.com/python/cpython
Revision 10df96affd0f3e21a7750db98038f8419b91db95 authored by Mariatta on 06 July 2017, 03:55:18 UTC, committed by GitHub on 06 July 2017, 03:55:18 UTC
(cherry picked from commit 76c567ee27342d76f631a35c8291b715b2a61f3e)
1 parent c48a000
Raw File
Tip revision: 10df96affd0f3e21a7750db98038f8419b91db95 authored by Mariatta on 06 July 2017, 03:55:18 UTC
Fix trivial typo in json module docstring (GH-2274) (GH-2431)
Tip revision: 10df96a
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