From b2406c0ee8970e410c5099a180a84985bb1da0fc Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 29 Oct 2012 18:23:08 +0100 Subject: [PATCH] delete broken C output file on compiler failures in trial&error mode --- Cython/Build/Dependencies.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Cython/Build/Dependencies.py b/Cython/Build/Dependencies.py index 640fcd3..e4871db 100644 --- a/Cython/Build/Dependencies.py +++ b/Cython/Build/Dependencies.py @@ -724,9 +724,12 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f import traceback traceback.print_exc() any_failures = 1 - if any_failures and raise_on_failure: - raise CompileError(None, pyx_file) - if fingerprint and not any_failures: + if any_failures: + if raise_on_failure: + raise CompileError(None, pyx_file) + elif os.path.exists(c_file): + os.remove(c_file) + elif fingerprint: f = open(c_file, 'rb') try: g = gzip_open(fingerprint_file, 'wb') -- 2.7.4