Commit f617fa88 authored by Benjamin Peterson's avatar Benjamin Peterson

merge 3.3

parents ec91cd60 cf626032
...@@ -1373,10 +1373,9 @@ def dash_R(the_module, test, indirect_test, huntrleaks): ...@@ -1373,10 +1373,9 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
try: try:
import zipimport import zipimport
except ImportError: except ImportError:
zsc = zdc = None # Run unmodified on platforms without zipimport support zdc = None # Run unmodified on platforms without zipimport support
else: else:
zdc = zipimport._zip_directory_cache.copy() zdc = zipimport._zip_directory_cache.copy()
zsc = zipimport._zip_stat_cache.copy()
abcs = {} abcs = {}
for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]: for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
if not isabstract(abc): if not isabstract(abc):
...@@ -1395,7 +1394,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks): ...@@ -1395,7 +1394,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
sys.stderr.flush() sys.stderr.flush()
for i in range(repcount): for i in range(repcount):
indirect_test() indirect_test()
alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs) alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, abcs)
sys.stderr.write('.') sys.stderr.write('.')
sys.stderr.flush() sys.stderr.flush()
if i >= nwarmup: if i >= nwarmup:
...@@ -1429,7 +1428,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks): ...@@ -1429,7 +1428,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
failed = True failed = True
return failed return failed
def dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs): def dash_R_cleanup(fs, ps, pic, zdc, abcs):
import gc, copyreg import gc, copyreg
import _strptime, linecache import _strptime, linecache
import urllib.parse, urllib.request, mimetypes, doctest import urllib.parse, urllib.request, mimetypes, doctest
...@@ -1455,8 +1454,6 @@ def dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs): ...@@ -1455,8 +1454,6 @@ def dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs):
else: else:
zipimport._zip_directory_cache.clear() zipimport._zip_directory_cache.clear()
zipimport._zip_directory_cache.update(zdc) zipimport._zip_directory_cache.update(zdc)
zipimport._zip_stat_cache.clear()
zipimport._zip_stat_cache.update(zsc)
# clear type cache # clear type cache
sys._clear_type_cache() sys._clear_type_cache()
......
...@@ -349,6 +349,11 @@ class ImportlibMigrationTests(unittest.TestCase): ...@@ -349,6 +349,11 @@ class ImportlibMigrationTests(unittest.TestCase):
def test_main(): def test_main():
run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests, run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests,
NestedNamespacePackageTest, ImportlibMigrationTests) 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__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment