summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2023-03-24 03:03:35 -0400
committerStefan Behnel <stefan_ml@behnel.de>2023-03-29 09:16:34 +0200
commit9c81e19edfc2db7f4055b5716da145ad381ec38f (patch)
tree8b5cd632ff340a1b403785fc89d8717cde7185fa
parenta121544a0a5117f194e99c363e23c3d3596cc080 (diff)
downloadcython-9c81e19edfc2db7f4055b5716da145ad381ec38f.tar.gz
Do not attempt to write out a depfile on failure (GH-5291)
This would be pretty useless as it cannot be used -- the output file does not exist either. But as it happens, on error, the output file is reset to None, so instead we triggered a python traceback while trying to write a depfile for `os.path.relpath(None, cwd)` that was written to `None+'.dep'`
-rw-r--r--Cython/Compiler/Main.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py
index 9c57452ba..561ac222d 100644
--- a/Cython/Compiler/Main.py
+++ b/Cython/Compiler/Main.py
@@ -514,7 +514,7 @@ def run_pipeline(source, options, full_module_name=None, context=None):
context.setup_errors(options, result)
err, enddata = Pipeline.run_pipeline(pipeline, source)
context.teardown_errors(err, options, result)
- if options.depfile:
+ if err is None and options.depfile:
from ..Build.Dependencies import create_dependency_tree
dependencies = create_dependency_tree(context).all_dependencies(result.main_source_file)
Utils.write_depfile(result.c_file, result.main_source_file, dependencies)