[holger krekel] > What do you mean with "generator's stack frame is popped"? At the end of eval_frame(): /* pop frame */ --tstate->recursion_depth; tstate->frame = f->f_back; return retval; The current frame is always popped from the thread state's frame stack, regardless of the reason for leaving eval_frame() (and generator yield is identical to function return in this respect). > I interpreted this code in ceval.c > > if (why != WHY_YIELD) { > /* Pop remaining stack entries -- but when yielding */ > while (!EMPTY()) { > v = POP(); > Py_XDECREF(v); > } > } > > to mean the frame is suspended with a preserved stack. > f_stacktop/last_i later are used to resume. Like that's news to me <wink>. Until it is resumed, the frame doesn't appear anywhere on the thread state's stack -- it would be lost entirely except that a generator-iterator object still holds a reference to it
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4