Visitar URL original
Stackless issue #272: convert macro HANDLE_UNWINDING to a function · akruis/cpython@f730a4e · GitHub
Skip to content

Commit f730a4e

Browse files
committed
Stackless issue python#272: convert macro HANDLE_UNWINDING to a function
Add some assertions
1 parent 38ae3be commit f730a4e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎Python/ceval.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@ do { \
615615
assert(SLP_FRAME_EXECUTING_VALUE == f->f_executing); \
616616
if (frame_func != SLP_FRAME_EXECUTING_VALUE) { \
617617
f->f_executing = (frame_func); \
618+
/* check argument: must be an executing frame with retval */ \
619+
assert(frame_func != SLP_FRAME_EXECUTING_NOVAL); \
620+
assert(SLP_FRAME_IS_EXECUTING(f)); \
618621
} \
619622
/* keep the reference to the frame to be called. */ \
620623
f->f_stacktop = stack_pointer; \
@@ -3840,11 +3843,15 @@ handle_unwinding(int lineno, PyFrameObject *f,
38403843
const _Py_CODEUNIT *first_instr, const _Py_CODEUNIT *next_instr,
38413844
char frame_func, int has_opcode, PyObject **pretval)
38423845
{
3846+
assert(*pretval); /* check argument */
38433847
if (has_opcode)
38443848
next_instr -= 1 + EXTENDED_ARG_OFFSET(oparg);
38453849
assert(SLP_FRAME_EXECUTING_VALUE == f->f_executing);
38463850
if (frame_func != SLP_FRAME_EXECUTING_VALUE) {
38473851
f->f_executing = frame_func;
3852+
/* check argument: must be an executing frame with retval */
3853+
assert(frame_func != SLP_FRAME_EXECUTING_NOVAL);
3854+
assert(SLP_FRAME_IS_EXECUTING(f));
38483855
}
38493856
/* keep the reference to the frame to be called. */
38503857
f->f_stacktop = stack_pointer;

0 commit comments

Comments
 (0)