Commit a027cca6 authored by Serhiy Storchaka's avatar Serhiy Storchaka

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

parent 48945e10
...@@ -1526,6 +1526,14 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs): ...@@ -1526,6 +1526,14 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
else: else:
ctypes._reset_cache() 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. # Collect cyclic trash and read memory statistics immediately after.
func1 = sys.getallocatedblocks func1 = sys.getallocatedblocks
func2 = sys.gettotalrefcount func2 = sys.gettotalrefcount
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment