Skip to content

Commit b28d85c

Browse files
check for error first
1 parent 3e09485 commit b28d85c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Python/ceval.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4809,7 +4809,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
48094809
DEOPT_IF(callable != cache1->obj, CALL_FUNCTION);
48104810

48114811
Py_ssize_t len_i = PyObject_Length(TOP());
4812-
PyObject *res = (len_i >= 0) ? PyLong_FromSsize_t(len_i) : NULL;
4812+
if (len_i < 0) {
4813+
goto error;
4814+
}
4815+
PyObject *res = PyLong_FromSsize_t(len_i);
48134816
assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
48144817

48154818
/* Clear the stack of the function object. */
@@ -4836,7 +4839,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
48364839
DEOPT_IF(callable != cache1->obj, CALL_FUNCTION);
48374840

48384841
int retval = PyObject_IsInstance(SECOND(), TOP());
4839-
PyObject *res = (retval >= 0) ? PyBool_FromLong(retval) : NULL;
4842+
if (retval < 0) {
4843+
goto error;
4844+
}
4845+
PyObject *res = PyBool_FromLong(retval);
48404846
assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
48414847

48424848
/* Clear the stack of the function object. */

0 commit comments

Comments
 (0)