On Tue, Jul 13, 2010 at 1:57 PM, Benjamin Peterson <benja...@python.org> wrote: .. > No! That's not recommended and a complete hack. The "dance" or > importlib.import_module is preferred.
Nevertheless, "a complete hack" is what PyImport_Import does: PyObject * PyImport_Import(PyObject *module_name) { static PyObject *silly_list = NULL; .. /* Call the __import__ function with the proper argument list * Always use absolute import here. */ r = PyObject_CallFunction(import, "OOOOi", module_name, globals, globals, silly_list, 0, NULL); .. } and _pickle.c uses PyImport_Import() and thus is different form pickle.py which uses the double-lookup dance. As a result, the two implementations are subtly different. They cannot be both right. It should be easy to "fix" _pickle.c to do the sys.modules lookup, but I am not sure this is right. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com