Skip to content

Commit

Permalink
Allow for runpy returning non-integer results.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jan 21, 2025
1 parent 7e5cfd0 commit 52bd4fa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion {{ cookiecutter.format }}/src/bootstrap/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,17 @@ int main(int argc, char *argv[]) {
debug_log("Could not determine exit code\n");
ret = -10;
}
else {
} else if (PyLong_Check(systemExit_code)) {
// SystemExit with error code
ret = (int) PyLong_AsLong(systemExit_code);
} else {
// Convert exit code to a string. This is required by runpy._error
ret = -11;
printf("---------------------------------------------------------------------------\n");
printf("Application quit abnormally!\n");

// Display exit message in the crash dialog.
PyObject_Print(systemExit_code, stdout, Py_PRINT_RAW);
}
} else {
ret = -6;
Expand Down

0 comments on commit 52bd4fa

Please sign in to comment.