Skip to content

Commit

Permalink
Do not attempt to write out a depfile on failure (GH-5291)
Browse files Browse the repository at this point in the history
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'`
  • Loading branch information
eli-schwartz authored and scoder committed Mar 29, 2023
1 parent a121544 commit 9c81e19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Cython/Compiler/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9c81e19

Please sign in to comment.