jiwon at softwise.co.kr
Mon Jun 7 13:21:45 EDT 2004
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.
add_submodule(PyObject *mod, PyObject *submod, char *fullname, char
if (mod == Py_None)
/* 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.) */
More information about the Python-Dev