[Import-sig] Imputil

M.-A. Lemburg mal@lemburg.com
Wed, 31 Jan 2001 15:25:06 +0100


Thomas Heller wrote:
> 
> I have the impression that we cannot currently
> import cPickle (for example) by imputil:
> 
> cPickle uses PyImport_ImportModule(name) instead of
> PyImport_Import(name) which would then in turn use the
> import hook function.
> cPickle imports copy_reg, string, types.
> 
> Is this observation correct?

>From looking at the cPickle.c code: no. cPickle comes with its
own PyImport_Import() API which looks very similar to the
one in Python/import.c (probably there for historic reasons).
The cPickle implementation uses __import__ as well, so there
should be no problem.

The various uses of PyImport_ImportModule() in cPickle are only
used for standard modules -- I don't think these pose much of
a problem w/r to imputil and other import hooks, since these
are either available using the standard import mechanism or
as frozen modules compiled into the core.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/