classification
Title: Remove inconsistent behavior between import and zipimport
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: acidbase, loewis (2)
Priority: normal Keywords patch

Created on 2005-11-03 03:43 by acidbase, last changed 2006-11-05 03:15 by loewis.

Files
File name Uploaded Description Edit Remove
patch_import.diff acidbase, 2005-11-03 03:43 Patch to 'fix' this inconsitent behavior import/zipimport
Messages (2)
msg48962 - (view) Author: Osvaldo Santana Neto (acidbase) Date: 2005-11-03 03:43
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
msg48963 - (view) Author: Martin v. Löwis (loewis) Date: 2006-11-05 03:15
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.
History
Date User Action Args
2005-11-03 03:43:17acidbasecreate