[pypy-svn] r55403 - pypy/dist/pypy/module/zipimport

fijal at codespeak.net fijal at codespeak.net
Thu May 29 18:58:45 CEST 2008


Author: fijal
Date: Thu May 29 18:58:44 2008
New Revision: 55403

Modified:
   pypy/dist/pypy/module/zipimport/interp_zipimport.py
Log:
Cosmetic fix for cpython regr test suite (__loader__ needs to be available
before module body runs)


Modified: pypy/dist/pypy/module/zipimport/interp_zipimport.py
==============================================================================
--- pypy/dist/pypy/module/zipimport/interp_zipimport.py	(original)
+++ pypy/dist/pypy/module/zipimport/interp_zipimport.py	Thu May 29 18:58:44 2008
@@ -144,10 +144,10 @@
         w = space.wrap
         w_mod = w(Module(space, w(modname)))
         real_name = self.name + os.path.sep + filename
+        space.setattr(w_mod, w('__loader__'), space.wrap(self))
         importing._prepare_module(space, w_mod, real_name, pkgpath)
         result = importing.load_source_module(space, w(modname), w_mod,
                                             filename, buf, write_pyc=False)
-        space.setattr(w_mod, w('__loader__'), space.wrap(self))
         return result
 
     def _parse_mtime(self, space, filename):
@@ -192,11 +192,11 @@
         buf = buf[8:] # XXX ugly copy, should use sequential read instead
         w_mod = w(Module(space, w(modname)))
         real_name = self.name + os.path.sep + filename
+        space.setattr(w_mod, w('__loader__'), space.wrap(self))
         importing._prepare_module(space, w_mod, real_name, pkgpath)
         result = importing.load_compiled_module(space, w(modname), w_mod,
                                                 filename, magic, timestamp,
                                                 buf)
-        space.setattr(w_mod, w('__loader__'), space.wrap(self))
         return result
 
     def have_modulefile(self, space, filename):



More information about the Pypy-commit mailing list