[pypy-svn] r75205 - in pypy/trunk/pypy/module/zipimport: . test
exarkun at codespeak.net
exarkun at codespeak.net
Tue Jun 8 18:12:11 CEST 2010
Author: exarkun
Date: Tue Jun 8 18:12:09 2010
New Revision: 75205
Modified:
pypy/trunk/pypy/module/zipimport/interp_zipimport.py
pypy/trunk/pypy/module/zipimport/test/test_zipimport.py
Log:
Set the `__path__` attribute of packages loaded from zip files correctly
The path in `__path__` should represent the directory from which the package
was imported; previously it was the path to the zipfile itself.
Modified: pypy/trunk/pypy/module/zipimport/interp_zipimport.py
==============================================================================
--- pypy/trunk/pypy/module/zipimport/interp_zipimport.py (original)
+++ pypy/trunk/pypy/module/zipimport/interp_zipimport.py Tue Jun 8 18:12:09 2010
@@ -242,7 +242,7 @@
pass
else:
if is_package:
- pkgpath = self.name
+ pkgpath = self.name + '/' + filename
else:
pkgpath = None
try:
Modified: pypy/trunk/pypy/module/zipimport/test/test_zipimport.py
==============================================================================
--- pypy/trunk/pypy/module/zipimport/test/test_zipimport.py (original)
+++ pypy/trunk/pypy/module/zipimport/test/test_zipimport.py Tue Jun 8 18:12:09 2010
@@ -201,7 +201,7 @@
self.writefile(self, "xxuuu/__init__.py", "")
self.writefile(self, "xxuuu/yy.py", "def f(x): return x")
mod = __import__("xxuuu", globals(), locals(), ['yy'])
- assert mod.__path__
+ assert mod.__path__ == [self.zipfile + "/xxuuu"]
assert mod.yy.f(3) == 3
def test_functions(self):
More information about the Pypy-commit
mailing list