gh-81057: Move More Globals in Core Code to _PyRuntimeState (gh-99516)

https://github.com/python/cpython/issues/81057
This commit is contained in:
Eric Snow 2022-11-16 09:37:14 -07:00 committed by GitHub
parent 5cfb7d19f5
commit 5f55067e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 241 additions and 130 deletions

View file

@ -1688,7 +1688,8 @@ run_eval_code_obj(PyThreadState *tstate, PyCodeObject *co, PyObject *globals, Py
* uncaught exception to trigger an unexplained signal exit from a future
* Py_Main() based one.
*/
_Py_UnhandledKeyboardInterrupt = 0;
// XXX Isn't this dealt with by the move to _PyRuntimeState?
_PyRuntime.signals.unhandled_keyboard_interrupt = 0;
/* Set globals['__builtins__'] if it doesn't exist */
if (globals != NULL && _PyDict_GetItemStringWithError(globals, "__builtins__") == NULL) {
@ -1702,7 +1703,7 @@ run_eval_code_obj(PyThreadState *tstate, PyCodeObject *co, PyObject *globals, Py
v = PyEval_EvalCode((PyObject*)co, globals, locals);
if (!v && _PyErr_Occurred(tstate) == PyExc_KeyboardInterrupt) {
_Py_UnhandledKeyboardInterrupt = 1;
_PyRuntime.signals.unhandled_keyboard_interrupt = 1;
}
return v;
}