[Python-checkins] Ensure that instruction cases are self-contained (GH-28938)
brandtbucher
webhook-mailer at python.org
Wed Oct 13 18:34:20 EDT 2021
https://github.com/python/cpython/commit/e71662c1ae817e728233ce93882c5b20f4c31ebc
commit: e71662c1ae817e728233ce93882c5b20f4c31ebc
branch: main
author: Brandt Bucher <brandt at python.org>
committer: brandtbucher <brandtbucher at gmail.com>
date: 2021-10-13T15:34:11-07:00
summary:
Ensure that instruction cases are self-contained (GH-28938)
files:
M Python/ceval.c
diff --git a/Python/ceval.c b/Python/ceval.c
index 0af233c0ba485..aef83b9c355fc 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1710,8 +1710,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
DISPATCH();
}
- /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */
TARGET(LOAD_CLOSURE) {
+ /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */
PyObject *value = GETLOCAL(oparg);
if (value == NULL) {
goto unbound_local_error;
@@ -3858,10 +3858,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
DISPATCH();
}
-#define CANNOT_CATCH_MSG "catching classes that do not inherit from "\
- "BaseException is not allowed"
-
TARGET(JUMP_IF_NOT_EXC_MATCH) {
+ const char *cannot_catch_msg = "catching classes that do not "
+ "inherit from BaseException is not "
+ "allowed";
PyObject *right = POP();
PyObject *left = POP();
if (PyTuple_Check(right)) {
@@ -3871,7 +3871,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
PyObject *exc = PyTuple_GET_ITEM(right, i);
if (!PyExceptionClass_Check(exc)) {
_PyErr_SetString(tstate, PyExc_TypeError,
- CANNOT_CATCH_MSG);
+ cannot_catch_msg);
Py_DECREF(left);
Py_DECREF(right);
goto error;
@@ -3881,7 +3881,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
else {
if (!PyExceptionClass_Check(right)) {
_PyErr_SetString(tstate, PyExc_TypeError,
- CANNOT_CATCH_MSG);
+ cannot_catch_msg);
Py_DECREF(left);
Py_DECREF(right);
goto error;
More information about the Python-checkins
mailing list