diff --git a/runtests.py b/runtests.py index fe9cae06bfbf5ca635cc556dc879960a6a68271f..ca9b683d177b32f7fe5cb4ec1641a65442d92cff 100755 --- a/runtests.py +++ b/runtests.py @@ -869,14 +869,13 @@ class CythonCompileTestCase(unittest.TestCase): if not self.cython_only: try: so_path = self.run_distutils(test_directory, module, workdir, incdir) - compiled = True except Exception: - compiled = False if expected_errors != '_FAIL_C_COMPILE': raise - if compiled and expected_errors == '_FAIL_C_COMPILE': - # must raise this outside the try block - raise RuntimeError('should have failed C compile') + else: + if expected_errors == '_FAIL_C_COMPILE': + # must raise this outside the try block + raise RuntimeError('should have failed C compile') return so_path class CythonRunTestCase(CythonCompileTestCase):