mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
Ensure that instruction cases are self-contained (GH-28938)
This commit is contained in:
parent
194a9526d8
commit
e71662c1ae
1 changed files with 6 additions and 6 deletions
|
@ -1710,8 +1710,8 @@ check_eval_breaker:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We keep LOAD_CLOSURE so that the bytecode stays more readable. */
|
|
||||||
TARGET(LOAD_CLOSURE) {
|
TARGET(LOAD_CLOSURE) {
|
||||||
|
/* We keep LOAD_CLOSURE so that the bytecode stays more readable. */
|
||||||
PyObject *value = GETLOCAL(oparg);
|
PyObject *value = GETLOCAL(oparg);
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
goto unbound_local_error;
|
goto unbound_local_error;
|
||||||
|
@ -3858,10 +3858,10 @@ check_eval_breaker:
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CANNOT_CATCH_MSG "catching classes that do not inherit from "\
|
|
||||||
"BaseException is not allowed"
|
|
||||||
|
|
||||||
TARGET(JUMP_IF_NOT_EXC_MATCH) {
|
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 *right = POP();
|
||||||
PyObject *left = POP();
|
PyObject *left = POP();
|
||||||
if (PyTuple_Check(right)) {
|
if (PyTuple_Check(right)) {
|
||||||
|
@ -3871,7 +3871,7 @@ check_eval_breaker:
|
||||||
PyObject *exc = PyTuple_GET_ITEM(right, i);
|
PyObject *exc = PyTuple_GET_ITEM(right, i);
|
||||||
if (!PyExceptionClass_Check(exc)) {
|
if (!PyExceptionClass_Check(exc)) {
|
||||||
_PyErr_SetString(tstate, PyExc_TypeError,
|
_PyErr_SetString(tstate, PyExc_TypeError,
|
||||||
CANNOT_CATCH_MSG);
|
cannot_catch_msg);
|
||||||
Py_DECREF(left);
|
Py_DECREF(left);
|
||||||
Py_DECREF(right);
|
Py_DECREF(right);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -3881,7 +3881,7 @@ check_eval_breaker:
|
||||||
else {
|
else {
|
||||||
if (!PyExceptionClass_Check(right)) {
|
if (!PyExceptionClass_Check(right)) {
|
||||||
_PyErr_SetString(tstate, PyExc_TypeError,
|
_PyErr_SetString(tstate, PyExc_TypeError,
|
||||||
CANNOT_CATCH_MSG);
|
cannot_catch_msg);
|
||||||
Py_DECREF(left);
|
Py_DECREF(left);
|
||||||
Py_DECREF(right);
|
Py_DECREF(right);
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue