Issue #28649: Clear the typing module caches when search for reference leaks.
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index f870854..885b14f 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1526,6 +1526,14 @@
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