summaryrefslogtreecommitdiffstats
path: root/Objects/genobject.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-04-01 15:00:31 (GMT)
committerGitHub <noreply@github.com>2021-04-01 15:00:31 (GMT)
commitfcb55c0037baab6f98f91ee38ce84b6f874f034a (patch)
tree29e1499f2f77ad8a4c76d5484517f46ac4fe8313 /Objects/genobject.c
parent2ac0515027699b5694d9a6ff40f1ddaba82c74c2 (diff)
downloadcpython-fcb55c0037baab6f98f91ee38ce84b6f874f034a.zip
cpython-fcb55c0037baab6f98f91ee38ce84b6f874f034a.tar.gz
cpython-fcb55c0037baab6f98f91ee38ce84b6f874f034a.tar.bz2
bpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally. (GH-25069)
* Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps. * Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r--Objects/genobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 26e27cc..6998967 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -357,7 +357,7 @@ _PyGen_yf(PyGenObject *gen)
return NULL;
}
- if (code[f->f_lasti + sizeof(_Py_CODEUNIT)] != YIELD_FROM)
+ if (code[(f->f_lasti+1)*sizeof(_Py_CODEUNIT)] != YIELD_FROM)
return NULL;
assert(f->f_stackdepth > 0);
yf = f->f_valuestack[f->f_stackdepth-1];
@@ -481,7 +481,7 @@ _gen_throw(PyGenObject *gen, int close_on_genexit,
Py_DECREF(ret);
/* Termination repetition of YIELD_FROM */
assert(gen->gi_frame->f_lasti >= 0);
- gen->gi_frame->f_lasti += sizeof(_Py_CODEUNIT);
+ gen->gi_frame->f_lasti += 1;
if (_PyGen_FetchStopIterationValue(&val) == 0) {
ret = gen_send(gen, val);
Py_DECREF(val);