Message195915
Why does PyImport_Import (import.c) call __import__ then immediately discard the result, and then look for the module again in the module dictionary?
It will return the same value in both cases no?
Ive included the relevant portion of the code below.
Its breaking an embedded application we've built where a hierarchy of modules are maintained outside the sys.modules dictionary.
/* Call the __import__ function with the proper argument list
Always use absolute import here.
Calling for side-effect of import. */
r = PyObject_CallFunction(import, "OOOOi", module_name, globals,
globals, silly_list, 0, NULL);
if (r == NULL)
goto err;
//-------------------------- WHY IS THIS SECTION NEEDED? --------
Py_DECREF(r);
modules = PyImport_GetModuleDict();
r = PyDict_GetItem(modules, module_name);
if (r != NULL)
//---------------------------------------------------------------
Py_INCREF(r); |
|
Date |
User |
Action |
Args |
2013-08-22 19:00:11 | Rob Bairos | set | recipients:
+ Rob Bairos |
2013-08-22 19:00:11 | Rob Bairos | set | messageid: <1377198011.48.0.462132559828.issue18812@psf.upfronthosting.co.za> |
2013-08-22 19:00:11 | Rob Bairos | link | issue18812 messages |
2013-08-22 19:00:11 | Rob Bairos | create | |
|