Issue #28649: Clear the typing module caches when search for reference leaks.

This commit is contained in:
Serhiy Storchaka 2016-11-09 23:51:54 +02:00
commit 04c954d275
1 changed files with 8 additions and 0 deletions

View File

@ -184,6 +184,14 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
else:
ctypes._reset_cache()
try:
typing = sys.modules['typing']
except KeyError:
pass
else:
for f in typing._cleanups:
f()
# Collect cyclic trash and read memory statistics immediately after.
func1 = sys.getallocatedblocks
func2 = sys.gettotalrefcount