Skip to content

Commit

Permalink
feat: Run Python byte-code compiler during /compile:1 (#4155)
Browse files Browse the repository at this point in the history
Co-authored-by: Robin Salkeld <salkeldr@amazon.com>
  • Loading branch information
fabiomadge and robin-aws authored Jun 8, 2023
1 parent 8461d05 commit a8bbb87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/DafnyCore/Compilers/Python/PythonBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public override bool CompileTargetProgram(string dafnyProgramName, string target
return false;
}
}
if (!runAfterCompile) {
var psi = PrepareProcessStartInfo("python3");
psi.Arguments = $"-m compileall -q {Path.GetDirectoryName(targetFilename)}";
return 0 == RunProcess(psi, outputWriter, outputWriter, "Error while compiling Python files.");
}
return true;
}

Expand Down
1 change: 1 addition & 0 deletions docs/dev/4155.feat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
After generating Python code we run the byte-code compiler to surface possible issues earlier, if it's not subsequently run.

0 comments on commit a8bbb87

Please sign in to comment.