Skip to content

Commit de65294

Browse files
graingertgvanrossum
andcommitted
raise SIGINT exit code on KeyboardInterrupt from pymain_run_module
Co-Authored-By: Guido van Rossum <guido@python.org>
1 parent e37a82a commit de65294

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ pymain_run_module(const wchar_t *modname, int set_argv0)
288288
return pymain_exit_err_print();
289289
}
290290
result = PyObject_Call(runmodule, runargs, NULL);
291+
if (!result && PyErr_Occurred() == PyExc_KeyboardInterrupt) {
292+
_Py_UnhandledKeyboardInterrupt = 1;
293+
}
291294
Py_DECREF(runpy);
292295
Py_DECREF(runmodule);
293296
Py_DECREF(module);

0 commit comments

Comments
 (0)