diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-06 15:03:57 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-06 15:03:57 +0100 |
commit | ecac91902b1c6d544c2b69f3613263c6d39177a8 (patch) | |
tree | 17b1ca780b66e636bc27e33d4567d1f580a6ca2e /Python/pythonrun.c | |
parent | caa7605b0166831ce8812dc556d594bd93d37ad4 (diff) | |
parent | 25d13f37aa6743282d0b8b4df687ff89999964b2 (diff) | |
download | cpython-git-ecac91902b1c6d544c2b69f3613263c6d39177a8.tar.gz |
Merge branch 'master' into bind-socket
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 94fcc6725e..906877a0a8 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1032,6 +1032,17 @@ static PyObject * run_eval_code_obj(PyCodeObject *co, PyObject *globals, PyObject *locals) { PyObject *v; + /* + * We explicitly re-initialize _Py_UnhandledKeyboardInterrupt every eval + * _just in case_ someone is calling into an embedded Python where they + * don't care about an uncaught KeyboardInterrupt exception (why didn't they + * leave config.install_signal_handlers set to 0?!?) but then later call + * Py_Main() itself (which _checks_ this flag and dies with a signal after + * its interpreter exits). We don't want a previous embedded interpreter's + * uncaught exception to trigger an unexplained signal exit from a future + * Py_Main() based one. + */ + _Py_UnhandledKeyboardInterrupt = 0; v = PyEval_EvalCode((PyObject*)co, globals, locals); if (!v && PyErr_Occurred() == PyExc_KeyboardInterrupt) { _Py_UnhandledKeyboardInterrupt = 1; |