[pypy-commit] pypy win32-cleanup: more os.path.sep fun

mattip noreply at buildbot.pypy.org
Sat Feb 4 23:46:41 CET 2012


Author: mattip
Branch: win32-cleanup
Changeset: r52108:7d3ad3fd6a7e
Date: 2012-02-05 00:45 +0200
http://bitbucket.org/pypy/pypy/changeset/7d3ad3fd6a7e/

Log:	more os.path.sep fun

diff --git a/pypy/module/zipimport/interp_zipimport.py b/pypy/module/zipimport/interp_zipimport.py
--- a/pypy/module/zipimport/interp_zipimport.py
+++ b/pypy/module/zipimport/interp_zipimport.py
@@ -383,7 +383,7 @@
     prefix = name[len(filename):]
     if prefix.startswith(os.path.sep) or prefix.startswith(ZIPSEP):
         prefix = prefix[1:]
-    if prefix and not prefix.endswith(ZIPSEP):
+    if prefix and not prefix.endswith(ZIPSEP) and not prefix.endswith(os.path.sep):
         prefix += ZIPSEP
     w_result = space.wrap(W_ZipImporter(space, name, filename, zip_file, prefix))
     zip_cache.set(filename, w_result)
diff --git a/pypy/module/zipimport/test/test_undocumented.py b/pypy/module/zipimport/test/test_undocumented.py
--- a/pypy/module/zipimport/test/test_undocumented.py
+++ b/pypy/module/zipimport/test/test_undocumented.py
@@ -119,7 +119,7 @@
             zip_importer = zipimport.zipimporter(path)
             assert isinstance(zip_importer, zipimport.zipimporter)
             assert zip_importer.archive == zip_path
-            assert zip_importer.prefix == prefix
+            assert zip_importer.prefix == prefix.replace('/', os.path.sep)
             assert zip_path in zipimport._zip_directory_cache
         finally:
             self.cleanup_zipfile(self.created_paths)


More information about the pypy-commit mailing list