File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -497,7 +497,7 @@ eval_frame(PyFrameObject *f)
497497#ifdef DXPAIRS
498498 int lastopcode = 0 ;
499499#endif
500- PyObject * * stack_pointer ;
500+ PyObject * * stack_pointer ; /* Next free slot in value stack */
501501 register unsigned char * next_instr ;
502502 register int opcode = 0 ; /* Current opcode */
503503 register int oparg = 0 ; /* Current opcode argument, if any */
@@ -586,7 +586,7 @@ eval_frame(PyFrameObject *f)
586586 next_instr = first_instr + f -> f_lasti ;
587587 stack_pointer = f -> f_stacktop ;
588588 assert (stack_pointer != NULL );
589- f -> f_stacktop = NULL ;
589+ f -> f_stacktop = NULL ; /* remains NULL unless yield suspends frame */
590590
591591 if (tstate -> use_tracing ) {
592592 if (tstate -> c_tracefunc != NULL ) {
@@ -634,6 +634,8 @@ eval_frame(PyFrameObject *f)
634634 w = NULL ;
635635
636636 for (;;) {
637+ assert (stack_pointer >= f -> f_valuestack ); /* else underflow */
638+ assert (STACK_LEVEL () <= f -> f_stacksize ); /* else overflow */
637639 /* Do periodic things. Doing this every time through
638640 the loop would add too much overhead, so we do it
639641 only every Nth instruction. We also do it if
You can’t perform that action at this time.
0 commit comments