Followup to r75965: replace the test_uuid-specific patch with a generic fix
(other tests may have the same problem).
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 2b8a6a7..75a74fa 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -996,6 +996,12 @@
             obj._abc_cache.clear()
             obj._abc_negative_cache.clear()
 
+    # Flush standard output, so that buffered data is sent to the OS and
+    # associated Python objects are reclaimed.
+    for stream in (sys.stdout, sys.stderr, sys.__stdout__, sys.__stderr__):
+        if stream is not None:
+            stream.flush()
+
     # Clear assorted module caches.
     _path_created.clear()
     re.purge()