[Python-Dev] Inconsistent behaviour in import/zipimport hooks

Osvaldo Santana osantana at gmail.com
Wed Nov 9 15:33:02 CET 2005


On 11/9/05, Guido van Rossum <guido at python.org> wrote:
> You didn't show us what's in the zip file.  Can you show a zipinfo output?

$ zipinfo modules.zip
Archive:  modules.zip   426 bytes   2 files
-rw-r--r--  2.3 unx      109 bx defN 31-Oct-05 14:49 module_o.pyo
-rw-r--r--  2.3 unx      109 bx defN 31-Oct-05 14:48 module_c.pyc
2 files, 218 bytes uncompressed, 136 bytes compressed:  37.6%

> My intention with import was always that without -O, *.pyo files are
> entirely ignored; and with -O, *.pyc files are entirely ignored.
>
> It sounds like you're saying that you want to change this so that .pyc
> and .pyo are always honored (with .pyc preferred if -O is not present
> and .pyo preferred if -O is present). I'm not sure that I like that
> better. If that's how zipimport works, I think it's broken!

Yes, this is how zipimport works and I think this is good in cases
where a third-party binary module/package is available only with .pyo
files and others only with .pyc files (without .py source files, of
course).

I know we can rename the files, but this is a good solution? Well, I
don't have a strong opinion about the solution adopted and I really
like to see other alternatives and opinions.

Thanks,
Osvaldo

--
Osvaldo Santana Neto (aCiDBaSe)
icq, url = (11287184, "http://www.pythonbrasil.com.br")


More information about the Python-Dev mailing list