[Python-checkins] cpython (merge 3.6 -> default): Issue #28649: Clear the typing module caches when search for reference leaks.

serhiy.storchaka python-checkins at python.org
Wed Nov 9 16:53:22 EST 2016


https://hg.python.org/cpython/rev/437564294e6c
changeset:   105029:437564294e6c
parent:      105026:08f76f89d199
parent:      105028:caf3ceb93307
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Nov 09 23:52:40 2016 +0200
summary:
  Issue #28649: Clear the typing module caches when search for reference leaks.

files:
  Lib/test/libregrtest/refleak.py |  8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -184,6 +184,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

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list