summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_zipimport.py9
-rw-r--r--Modules/zipimport.c2
2 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index 07520a78eb..5f6d8ef056 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -30,7 +30,8 @@ else:
TESTMOD = "ziptestmodule"
TESTPACK = "ziptestpackage"
-TEMP_ZIP = "junk95142.zip"
+TESTPACK2 = "ziptestpackage2"
+TEMP_ZIP = os.path.abspath("junk95142.zip")
class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
@@ -139,11 +140,11 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
def testDeepPackage(self):
packdir = TESTPACK + os.sep
- packdir2 = packdir + packdir
+ packdir2 = packdir + TESTPACK2 + os.sep
files = {packdir + "__init__" + pyc_ext: (NOW, test_pyc),
packdir2 + "__init__" + pyc_ext: (NOW, test_pyc),
packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc)}
- self.doTest(pyc_ext, files, TESTPACK, TESTPACK, TESTMOD)
+ self.doTest(pyc_ext, files, TESTPACK, TESTPACK2, TESTMOD)
def testGetData(self):
z = ZipFile(TEMP_ZIP, "w")
@@ -163,7 +164,7 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
src = """if 1: # indent hack
def get_file():
return __file__
- if __importer__.get_data("some.data") != "some data":
+ if __loader__.get_data("some.data") != "some data":
raise AssertionError, "bad data"\n"""
pyc = make_pyc(compile(src, "<???>", "exec"), NOW)
files = {TESTMOD + pyc_ext: (NOW, pyc),
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index f3f5245752..b12f1ab463 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -103,7 +103,7 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
break;
}
/* back up one path element */
- p = strchr(buf, SEP);
+ p = strrchr(buf, SEP);
if (prefix != NULL)
*prefix = SEP;
if (p == NULL)