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

This commit is contained in:
Serhiy Storchaka 2016-11-09 23:49:02 +02:00
parent 9b10756019
commit 28f42fd4f8
1 changed files with 8 additions and 0 deletions

View File

@ -1526,6 +1526,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