summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-08-20 15:19:14 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-08-20 15:19:14 (GMT)
commit62897c5c13ad24b5f192495b6979f3778de1678f (patch)
tree1c9090a0cffbcb1fe9a412f93312e8eacde5cfaf
parent4d5ef6aed6c22ade015d872324f53c9fbc16c46d (diff)
downloadcpython-62897c5c13ad24b5f192495b6979f3778de1678f.zip
cpython-62897c5c13ad24b5f192495b6979f3778de1678f.tar.gz
cpython-62897c5c13ad24b5f192495b6979f3778de1678f.tar.bz2
My patch #597221. Use f_lasti more consistently.
-rw-r--r--Python/ceval.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 00237c0..3494a38 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -599,12 +599,15 @@ eval_frame(PyFrameObject *f)
fastlocals = f->f_localsplus;
freevars = f->f_localsplus + f->f_nlocals;
_PyCode_GETCODEPTR(co, &first_instr);
- if (f->f_lasti < 0) {
- next_instr = first_instr;
- }
- else {
- next_instr = first_instr + f->f_lasti;
- }
+ /* An explanation is in order for the next line.
+
+ f->f_lasti now refers to the index of the last instruction
+ executed. You might think this was obvious from the name, but
+ this wasn't always true before 2.3! PyFrame_New now sets
+ f->f_lasti to -1 (i.e. the index *before* the first instruction
+ and YIELD_VALUE doesn't fiddle with f_lasti any more. So this
+ does work. Promise. */
+ next_instr = first_instr + f->f_lasti + 1;
stack_pointer = f->f_stacktop;
assert(stack_pointer != NULL);
f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */
@@ -1521,9 +1524,6 @@ eval_frame(PyFrameObject *f)
case YIELD_VALUE:
retval = POP();
f->f_stacktop = stack_pointer;
- /* abuse the lasti field: here it points to
- the *next* instruction */
- f->f_lasti = INSTR_OFFSET();
why = WHY_YIELD;
break;