[Patches] [ python-Patches-1346572 ] Remove inconsistent behavior between import and zipimport

SourceForge.net noreply at sourceforge.net
Sun Nov 5 04:15:52 CET 2006


Patches item #1346572, was opened at 2005-11-03 04:43
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1346572&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Osvaldo Santana Neto (acidbase)
Assigned to: Nobody/Anonymous (nobody)
Summary: Remove inconsistent behavior between import and zipimport

Initial Comment:
Look the inconsistent behavior:
$ ls
modulo_c.pyc  modulo_o.pyo
$ zip modulos.zip modulo_o.pyo modulo_c.pyc
  adding: modulo_o.pyo (deflated 38%)
  adding: modulo_c.pyc (deflated 38%)
$ ls
modulo_c.pyc  modulo_o.pyo  modulos.zip

$ python2.4
>>> import modulo_c
modulo_c
>>> import modulo_o
ImportError: No module named modulo_o

$ python2.4 -O
>>> import modulo_c
ImportError: No module named modulo_c
>>> import modulo_o
modulo_o

$ rm *.pyc *.pyo
$ ls
modulos.zip
$ PYTHONPATH=modulos.zip python2.4
>>> import modulo_c
modulo_c
>>> import modulo_o
modulo_o
$ PYTHONPATH=modulos.zip python2.4 -O
>>> import modulo_c
modulo_c
>>> import modulo_o
modulo_o

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-11-05 04:15

Message:
Logged In: YES 
user_id=21627

The discussion on python-dev (both last year's and this
year's) has shown that this is the wrong way of fixing the
inconsistency. Instead, zipfile should stop importing .pyo
files when -O isn't given. Rejecting the patch as invalid.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1346572&group_id=5470


More information about the Patches mailing list