[Python-Dev] Import APIs (original) (raw)

Georg Brandl g.brandl at gmx.net
Mon Mar 12 20:19:28 CET 2007


IMHO yes, for all occurences in the core code.

Guido van Rossum schrieb:

what's the situation for Py3k? Should it always use absolute import there?

On 3/10/07, Georg Brandl <g.brandl at gmx.net> wrote: Currently, all C code that needs to import a module uses PyImportImportModule which (1) calls builtin.import (2) attempts relative imports

Most of the time, though, at least (2) is wrong. If we want to keep (1), PyImportImportModuleLevel can't be used as a replacement. So there should be a new API, called PyImportImportAbsolute that gets a flag whether relative import should be allowed. Georg



More information about the Python-Dev mailing list