]> granicus.if.org Git - python/commitdiff
Plug a leak in the ctypes test suite when tests are run repeatedly.
authorThomas Heller <theller@ctypes.org>
Mon, 20 Mar 2006 08:11:56 +0000 (08:11 +0000)
committerThomas Heller <theller@ctypes.org>
Mon, 20 Mar 2006 08:11:56 +0000 (08:11 +0000)
Lib/ctypes/test/test_keeprefs.py

index 39e70e335cb6b89283f9d75611b27a27cca996fc..7318f290e641466895ee89bcc6cefdc91fa641c8 100644 (file)
@@ -140,5 +140,10 @@ class PointerToStructure(unittest.TestCase):
         r.a[0].x = 42
         r.a[0].y = 99
 
+        # to avoid leaking when tests are run several times
+        # clean up the types left in the cache.
+        from ctypes import _pointer_type_cache
+        del _pointer_type_cache[POINT]
+
 if __name__ == "__main__":
     unittest.main()