From b5bcc8c426db101225e20885b25aa5a0c96ff52b Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Thu, 21 Jan 2010 19:46:55 -0800 Subject: [PATCH] Fix too many open files bug in testrunner. It seems that temp file handles don't work well with fork. --- runtests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtests.py b/runtests.py index 18ead284..9ac487f7 100644 --- a/runtests.py +++ b/runtests.py @@ -404,12 +404,12 @@ class CythonRunTestCase(CythonCompileTestCase): # fork to make sure we do not keep the tested module loaded result_handle, result_file = tempfile.mkstemp() + os.close(result_handle) child_id = os.fork() if not child_id: result_code = 0 try: try: - output = os.fdopen(result_handle, 'wb') tests = None try: partial_result = PartialTestResult(result) @@ -425,6 +425,7 @@ class CythonRunTestCase(CythonCompileTestCase): **{module_name: None}) partial_result.addError(tests, sys.exc_info()) result_code = 1 + output = open(result_file, 'wb') pickle.dump(partial_result.data(), output) except: import traceback -- 2.26.2