A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-June/045270.html below:

[Python-Dev] Python/import.c

[Python-Dev] Python/import.cJiwon Seo 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.

...
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

More information about the Python-Dev mailing list

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