Issue #13380: add an internal function for resetting the ctypes caches
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 10b515b..cbbf1ca 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1255,6 +1255,13 @@
     filecmp._cache.clear()
     struct._clearcache()
     doctest.master = None
+    try:
+        import ctypes
+    except ImportError:
+        # Don't worry about resetting the cache if ctypes is not supported
+        pass
+    else:
+        ctypes._reset_cache()
 
     # Collect cyclic trash.
     gc.collect()