Staging
v0.5.1
https://github.com/python/cpython
Revision f4dc9204cc406ab41c2d643c1a64375a6a2954e5 authored by Brett Cannon on 10 August 2012, 16:21:12 UTC, committed by Brett Cannon on 10 August 2012, 16:21:12 UTC
state of the import system. Also make importlib.invalidate_caches()
work with sys.meta_path instead of sys.path_importer_cache to
completely separate the path-based import system from the overall
import system.

Patch by Eric Snow.
1 parent 2d6266d
Raw File
Tip revision: f4dc9204cc406ab41c2d643c1a64375a6a2954e5 authored by Brett Cannon on 10 August 2012, 16:21:12 UTC
Issue #15502: Finish bringing importlib.abc in line with the current
Tip revision: f4dc920
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