[pypy-svn] r47836 - in pypy/dist/pypy/module/zipimport: . test

fijal at codespeak.net fijal at codespeak.net
Wed Oct 24 16:46:59 CEST 2007


Author: fijal
Date: Wed Oct 24 16:46:59 2007
New Revision: 47836

Modified:
   pypy/dist/pypy/module/zipimport/interp_zipimport.py
   pypy/dist/pypy/module/zipimport/test/test_zipimport.py
Log:
Add .archive attribute


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	Wed Oct 24 16:46:59 2007
@@ -162,6 +162,9 @@
             "Cannot find module %s in %s" % (filename, self.name)))
     is_package.unwrap_spec = ['self', ObjSpace, str]
 
+    def getarchive(space, self):
+        return space.wrap(self.name)
+
 def descr_new_zipimporter(space, w_type, name):
     try:
         return zip_importer_cache[name]
@@ -200,4 +203,5 @@
     get_source  = interp2app(W_ZipImporter.get_source),
     is_package  = interp2app(W_ZipImporter.is_package),
     load_module = interp2app(W_ZipImporter.load_module),
+    archive     = GetSetProperty(W_ZipImporter.getarchive),
 )

Modified: pypy/dist/pypy/module/zipimport/test/test_zipimport.py
==============================================================================
--- pypy/dist/pypy/module/zipimport/test/test_zipimport.py	(original)
+++ pypy/dist/pypy/module/zipimport/test/test_zipimport.py	Wed Oct 24 16:46:59 2007
@@ -175,3 +175,4 @@
         #assert z.get_code('uu') == self.co
         assert z.get_code('xx')
         assert z.get_source('xx') == "5"
+        assert z.archive == self.zipfile



More information about the Pypy-commit mailing list