Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
50b82c76
Commit
50b82c76
authored
Jan 09, 2014
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clear zip stat cache after each ref leak run
parent
768c16ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
Lib/test/regrtest.py
Lib/test/regrtest.py
+7
-4
Lib/test/test_pkgutil.py
Lib/test/test_pkgutil.py
+0
-5
No files found.
Lib/test/regrtest.py
View file @
50b82c76
...
...
@@ -1318,9 +1318,10 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
try:
import zipimport
except ImportError:
zdc = None # Run unmodified on platforms without zipimport support
z
sc = z
dc = 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):
...
...
@@ -1343,13 +1344,13 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
print("beginning", repcount, "repetitions", file=sys.stderr)
print(("1234567890"*(repcount//10 + 1))[:repcount], file=sys.stderr)
sys.stderr.flush()
dash_R_cleanup(fs, ps, pic, zdc, abcs)
dash_R_cleanup(fs, ps, pic, zdc,
zsc,
abcs)
for i in range(repcount):
rc_before = sys.gettotalrefcount()
run_the_test()
sys.stderr.write('.')
sys.stderr.flush()
dash_R_cleanup(fs, ps, pic, zdc, abcs)
dash_R_cleanup(fs, ps, pic, zdc,
zsc,
abcs)
rc_after = sys.gettotalrefcount()
if i >= nwarmup:
deltas.append(rc_after - rc_before)
...
...
@@ -1364,7 +1365,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
return True
return False
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
...
...
@@ -1390,6 +1391,8 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
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()
...
...
Lib/test/test_pkgutil.py
View file @
50b82c76
...
...
@@ -338,11 +338,6 @@ class ImportlibMigrationTests(unittest.TestCase):
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__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment