diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 22:43:33 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 22:43:33 +0200 |
commit | afed6ecf218c498ecded76fd03519ea9644737f2 (patch) | |
tree | a1ba17cc771a7bad78cff0802f5822127f396b87 /Lib/test/support.py | |
parent | e720725c12e37a1081e2f493b67254096f6d5aa3 (diff) | |
parent | f7f54759b5f81cc011e987746ed3edd7fcc96d21 (diff) | |
download | cpython-git-afed6ecf218c498ecded76fd03519ea9644737f2.tar.gz |
Merge from 3.2
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r-- | Lib/test/support.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index 3dc4bfb108..89ace45c36 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -24,9 +24,15 @@ import sysconfig import logging.handlers try: - import _thread + import _thread, threading except ImportError: _thread = None + threading = None +try: + import multiprocessing.process +except ImportError: + multiprocessing = None + try: import zlib @@ -1358,19 +1364,20 @@ def modules_cleanup(oldmodules): def threading_setup(): if _thread: - return _thread._count(), + return _thread._count(), threading._dangling.copy() else: - return 1, + return 1, () -def threading_cleanup(nb_threads): +def threading_cleanup(*original_values): if not _thread: return _MAX_COUNT = 10 for count in range(_MAX_COUNT): - n = _thread._count() - if n == nb_threads: + values = _thread._count(), threading._dangling + if values == original_values: break time.sleep(0.1) + gc_collect() # XXX print a warning in case of failure? def reap_threads(func): |