Skip to content

Commit f132ddd

Browse files
author
Anselm Kruis
committed
Stackless issue python#187: refactor the Stackless ceval.c patch
Reorder frame function tests to check the most likely condition first.
1 parent 5234a8f commit f132ddd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Python/ceval.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,11 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
10251025
PUSH(retval); /* we are back from a function call */
10261026
}
10271027
else {
1028-
if (f->f_execute == slp_eval_frame_iter) {
1028+
if (f->f_execute == slp_eval_frame_noval) {
1029+
/* don't push it, frame ignores value */
1030+
Py_XDECREF(retval);
1031+
}
1032+
else if (f->f_execute == slp_eval_frame_iter) {
10291033
/* finalise the for_iter operation */
10301034
NEXTOPARG();
10311035
if (opcode == EXTENDED_ARG) {
@@ -1096,14 +1100,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
10961100
/*f->f_execute = PyEval_EvalFrame_value;
10971101
PREDICT(WITH_CLEANUP_FINISH); */
10981102
}
1099-
}
1100-
else {
1101-
/* don't push it, frame ignores value */
1102-
assert (f->f_execute == slp_eval_frame_noval);
1103-
Py_XDECREF(retval);
1104-
}
1103+
} else
1104+
Py_FatalError("invalid frame function");
11051105
f->f_execute = slp_eval_frame_value;
1106-
11071106
}
11081107

11091108
/* always check for an error flag */

0 commit comments

Comments
 (0)