[Python-Dev] pyc archives (was: .DLL vs .PYD search order)

Greg Stein gstein@lyra.org
Sat, 4 Dec 1999 17:17:57 -0800 (PST)


On Sat, 4 Dec 1999, James C. Ahlstrom wrote:
>...
> One possible archive file format holds its list of archived
> *.pyc file names as keys in a dictionary.  This is simple and
> efficient, but fails to correctly address the problem of shared
> libs (aka DLL's in Windows) with names identical to names of
> *.pyc files in the archive.  For example, suppose foo.pyc is in the
> archive, and foo.dll is in a directory.  Suppose sys.path is to be
> used to decide whether to load foo.pyc or foo.dll.  Then an
> "archive importer" will fail to do this.  Specifically you can't
> see if foo.pyc is in the archive and then check sys.path, nor can
> you do the reverse.  You must call the "archive importer" repeatedly
> for each element of sys.path and search the directory at the same time.

What? The archive is independent of each .pyc's original position in
sys.path. There is no reason/need to carry that information into an
archive.

If the archive contains "foo", then you're done. If it doesn't, then move
on to the next element of sys.path (directory or Importer instance) and
look there.

Basically: if you deploy an archive, then all of its files will take
precedence over any file found later on sys.path. This is exactly what
sys.path is about: establishing precedence.

If I understand you correctly, then you're trying to say there is some
sort of interleaving that must occur. If so, then I don't understand why.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/