It looks like it's because even if the package failed to be loaded, it should be added to its parent module dict, IMHO. The comment in the import.c::add_submodule describes the behavior. I don't know how it could be useful, but I think it's the way import behaves. ... static int add_submodule(PyObject *mod, PyObject *submod, char *fullname, char *subname, PyObject *modules) { if (mod == Py_None) return 1; /* Irrespective of the success of this load, make a reference to it in the parent package module. A copy gets saved in the modules dictionary under the full name, so get a reference from there, if need be. (The exception is when the load failed with a SyntaxError -- then there's no trace in sys.modules. In that case, of course, do nothing extra.) */ ... Jiwon
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