In the context of http://www.python.org/sf/845802 I'm looking at the code in Python/import.c, function load_package(). The latter part of the function is this code, which tries to import the __init__.py file, after building the module object in 'm', and initializing it's __file__ and __path__ attributes: fdp = find_module(name, "__init__", path, buf, sizeof(buf), &fp, NULL); if (fdp == NULL) { if (PyErr_ExceptionMatches(PyExc_ImportError)) { PyErr_Clear(); } else m = NULL; goto cleanup; } m = load_module(name, fp, buf, fdp->type, NULL); if (fp != NULL) fclose(fp); cleanup: Py_XDECREF(path); Py_XDECREF(file); return m; } I do not understand why the function doesn't fail when find_module returns NULL because of an PyExc_ImportError. For the above mentioned bug, when __init__.py is a directory instead of a file, find_module returns NULL. Thomas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4