Prevent spurious leaks when running regrtest.py -R. There may be more

issues that crop up from time to time, but this change seems to have been
pretty stable (no spurious warnings) for about a week.

Other modules which use threads may require similar use of
threading_setup/threading_cleanup from test_support.
This commit is contained in:
Neal Norwitz 2006-06-18 19:35:01 +00:00
parent f5da071ec8
commit 9602cc2aa4
4 changed files with 30 additions and 2 deletions

View file

@ -22,7 +22,7 @@ FILES_PER_THREAD = 50 # change w/ -f option
import thread # If this fails, we can't test this module
import threading
from test.test_support import TestFailed
from test.test_support import TestFailed, threading_setup, threading_cleanup
import StringIO
from traceback import print_exc
import tempfile
@ -48,6 +48,7 @@ class TempFileGreedy(threading.Thread):
def test_main():
threads = []
thread_info = threading_setup()
print "Creating"
for i in range(NUM_THREADS):
@ -72,6 +73,7 @@ def test_main():
if errors:
raise TestFailed(msg)
threading_cleanup(*thread_info)
if __name__ == "__main__":
import sys, getopt