Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f617fa8

Browse files
committed
merge 3.3
2 parents ec91cd6 + cf62603 commit f617fa8

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

Lib/test/regrtest.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,10 +1373,9 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
13731373
try:
13741374
import zipimport
13751375
except ImportError:
1376-
zsc = zdc = None # Run unmodified on platforms without zipimport support
1376+
zdc = None # Run unmodified on platforms without zipimport support
13771377
else:
13781378
zdc = zipimport._zip_directory_cache.copy()
1379-
zsc = zipimport._zip_stat_cache.copy()
13801379
abcs = {}
13811380
for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
13821381
if not isabstract(abc):
@@ -1395,7 +1394,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
13951394
sys.stderr.flush()
13961395
for i in range(repcount):
13971396
indirect_test()
1398-
alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs)
1397+
alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, abcs)
13991398
sys.stderr.write('.')
14001399
sys.stderr.flush()
14011400
if i >= nwarmup:
@@ -1429,7 +1428,7 @@ def check_alloc_deltas(deltas):
14291428
failed = True
14301429
return failed
14311430

1432-
def dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs):
1431+
def dash_R_cleanup(fs, ps, pic, zdc, abcs):
14331432
import gc, copyreg
14341433
import _strptime, linecache
14351434
import urllib.parse, urllib.request, mimetypes, doctest
@@ -1455,8 +1454,6 @@ def dash_R_cleanup(fs, ps, pic, zdc, zsc, abcs):
14551454
else:
14561455
zipimport._zip_directory_cache.clear()
14571456
zipimport._zip_directory_cache.update(zdc)
1458-
zipimport._zip_stat_cache.clear()
1459-
zipimport._zip_stat_cache.update(zsc)
14601457

14611458
# clear type cache
14621459
sys._clear_type_cache()

Lib/test/test_pkgutil.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ def test_iter_importers_avoids_emulation(self):
349349
def test_main():
350350
run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests,
351351
NestedNamespacePackageTest, ImportlibMigrationTests)
352+
# this is necessary if test is run repeated (like when finding leaks)
353+
import zipimport
354+
import importlib
355+
zipimport._zip_directory_cache.clear()
356+
importlib.invalidate_caches()
352357

353358

354359
if __name__ == '__main__':

0 commit comments

Comments
 (0)