[Python-checkins] cpython (merge 3.3 -> default): merge 3.3

benjamin.peterson python-checkins at python.org
Thu Jan 9 18:12:45 CET 2014


http://hg.python.org/cpython/rev/73228af705f6
changeset:   88371:73228af705f6
parent:      88369:04c05e408cbd
parent:      88370:fafac90b69c4
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Jan 09 11:12:31 2014 -0600
summary:
  merge 3.3

files:
  Lib/test/regrtest.py     |  9 ++++++---
  Lib/test/test_pkgutil.py |  5 -----
  2 files changed, 6 insertions(+), 8 deletions(-)


diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1373,9 +1373,10 @@
     try:
         import zipimport
     except ImportError:
-        zdc = None # Run unmodified on platforms without zipimport support
+        zsc = zdc = None # Run unmodified on platforms without zipimport support
     else:
         zdc = zipimport._zip_directory_cache.copy()
+        zsc = zipimport._zip_stat_cache.copy()
     abcs = {}
     for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
         if not isabstract(abc):
@@ -1394,7 +1395,7 @@
     sys.stderr.flush()
     for i in range(repcount):
         indirect_test()
-        alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, abcs)
+        alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs)
         sys.stderr.write('.')
         sys.stderr.flush()
         if i >= nwarmup:
@@ -1428,7 +1429,7 @@
             failed = True
     return failed
 
-def dash_R_cleanup(fs, ps, pic, zdc, abcs):
+def dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs):
     import gc, copyreg
     import _strptime, linecache
     import urllib.parse, urllib.request, mimetypes, doctest
@@ -1454,6 +1455,8 @@
     else:
         zipimport._zip_directory_cache.clear()
         zipimport._zip_directory_cache.update(zdc)
+        zipimport._zip_stat_cache.clear()
+        zipimport._zip_stat_cache.update(zsc)
 
     # clear type cache
     sys._clear_type_cache()
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py
--- a/Lib/test/test_pkgutil.py
+++ b/Lib/test/test_pkgutil.py
@@ -349,11 +349,6 @@
 def test_main():
     run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests,
                  NestedNamespacePackageTest, ImportlibMigrationTests)
-    # this is necessary if test is run repeated (like when finding leaks)
-    import zipimport
-    import importlib
-    zipimport._zip_directory_cache.clear()
-    importlib.invalidate_caches()
 
 
 if __name__ == '__main__':

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list