summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2021-11-10 18:08:28 (GMT)
committerGitHub <noreply@github.com>2021-11-10 18:08:28 (GMT)
commit4cdeee5978ee3f8ea7fe95172ae04d866cd88177 (patch)
tree05bb2cf298351932ff37afd10b1befffc793d340 /Python/ceval.c
parent05fbd60147456d77a7aecf29dddd86c5bde5872f (diff)
downloadcpython-4cdeee5978ee3f8ea7fe95172ae04d866cd88177.zip
cpython-4cdeee5978ee3f8ea7fe95172ae04d866cd88177.tar.gz
cpython-4cdeee5978ee3f8ea7fe95172ae04d866cd88177.tar.bz2
bpo-45711: remove unnecessary DUP_TOP and POP in exception handling (GH-29495)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index c9f6638..fadb97a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3907,7 +3907,7 @@ check_eval_breaker:
"inherit from BaseException is not "
"allowed";
PyObject *right = POP();
- PyObject *left = POP();
+ PyObject *left = TOP();
if (PyTuple_Check(right)) {
Py_ssize_t i, length;
length = PyTuple_GET_SIZE(right);
@@ -3916,7 +3916,6 @@ check_eval_breaker:
if (!PyExceptionClass_Check(exc)) {
_PyErr_SetString(tstate, PyExc_TypeError,
cannot_catch_msg);
- Py_DECREF(left);
Py_DECREF(right);
goto error;
}
@@ -3926,13 +3925,11 @@ check_eval_breaker:
if (!PyExceptionClass_Check(right)) {
_PyErr_SetString(tstate, PyExc_TypeError,
cannot_catch_msg);
- Py_DECREF(left);
Py_DECREF(right);
goto error;
}
}
int res = PyErr_GivenExceptionMatches(left, right);
- Py_DECREF(left);
Py_DECREF(right);
if (res > 0) {
/* Exception matches -- Do nothing */;