summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2023-03-24 03:03:35 -0400
committerGitHub <noreply@github.com>2023-03-24 08:03:35 +0100
commit8a787ad1fcd3989d5bd3afffd234157873ab5dc3 (patch)
treeb19fb5fae0df86090cef0608e997a30b6114019d
parentd3a6d90ffda05e4d571b6f5134b77d6df4fab04b (diff)
downloadcython-8a787ad1fcd3989d5bd3afffd234157873ab5dc3.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 e2aac8ef6..36813975d 100644
--- a/Cython/Compiler/Main.py
+++ b/Cython/Compiler/Main.py
@@ -527,7 +527,7 @@ def run_pipeline(source, options, full_module_name=None, context=None):
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)