mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (#21956)
Closes bpo issue 41602
This commit is contained in:
parent
ea0711a9f9
commit
a68a2ad19c
3 changed files with 94 additions and 9 deletions
|
@ -287,7 +287,11 @@ pymain_run_module(const wchar_t *modname, int set_argv0)
|
|||
Py_DECREF(module);
|
||||
return pymain_exit_err_print();
|
||||
}
|
||||
_Py_UnhandledKeyboardInterrupt = 0;
|
||||
result = PyObject_Call(runmodule, runargs, NULL);
|
||||
if (!result && PyErr_Occurred() == PyExc_KeyboardInterrupt) {
|
||||
_Py_UnhandledKeyboardInterrupt = 1;
|
||||
}
|
||||
Py_DECREF(runpy);
|
||||
Py_DECREF(runmodule);
|
||||
Py_DECREF(module);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue