summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-09 23:51:54 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-09 23:51:54 +0200
commit04c954d2754e917c037c032579ee5aa95da6529e (patch)
tree236e68f12cc76cdbf52f7fe6fd0301437f2d3bd0
parent5486a8842717def49a592dfdae89f831aeb1277c (diff)
parent28f42fd4f813b4be15b47629c557ef8f958727cb (diff)
downloadcpython-git-04c954d2754e917c037c032579ee5aa95da6529e.tar.gz
Issue #28649: Clear the typing module caches when search for reference leaks.
-rw-r--r--Lib/test/libregrtest/refleak.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
index 59dc49fe77..3bed59666f 100644
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -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