Skip to content

Commit 7749f82

Browse files
author
Anselm Kruis
committed
Stackless issue python#133: fix wordcode.
Fix the wordcode processing again.
1 parent a095a2b commit 7749f82

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Python/ceval.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,11 +1277,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
12771277
else {
12781278
if (f->f_execute == slp_eval_frame_iter) {
12791279
/* finalise the for_iter operation */
1280-
opcode = NEXTOP();
1281-
oparg = NEXTARG();
1280+
NEXTOPARG();
12821281
if (opcode == EXTENDED_ARG) {
1283-
opcode = NEXTOP();
1284-
oparg = oparg<<8 | NEXTARG();
1282+
int oldoparg = oparg;
1283+
NEXTOPARG();
1284+
oparg |= oldoparg << 8;
12851285
}
12861286
assert(opcode == FOR_ITER);
12871287

@@ -1312,11 +1312,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
13121312
}
13131313
else if (f->f_execute == slp_eval_frame_setup_with) {
13141314
/* finalise the SETUP_WITH operation */
1315-
opcode = NEXTOP();
1316-
oparg = NEXTARG();
1315+
NEXTOPARG();
13171316
if (opcode == EXTENDED_ARG) {
1318-
opcode = NEXTOP();
1319-
oparg = oparg<<8 | NEXTARG();
1317+
int oldoparg = oparg;
1318+
NEXTOPARG();
1319+
oparg |= oldoparg << 8;
13201320
}
13211321
assert(opcode == SETUP_WITH);
13221322

@@ -3891,10 +3891,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
38913891
#define EXTENDED_ARG_OFFSET(x) \
38923892
(assert(sizeof(x) == 4), \
38933893
(!((x) >> 8) ? 0 : \
3894-
(!((x) >> 16) ? 2 : \
3895-
(!((x) >> 24) ? 4 : 6 ))))
3894+
(!((x) >> 16) ? 1 : \
3895+
(!((x) >> 24) ? 2 : 3 ))))
38963896

3897-
next_instr -= 2 + EXTENDED_ARG_OFFSET(oparg);
3897+
next_instr -= 1 + EXTENDED_ARG_OFFSET(oparg);
38983898

38993899
stackless_call:
39003900
/*
@@ -3928,12 +3928,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
39283928

39293929
f->f_stacktop = NULL;
39303930
if (f->f_execute == slp_eval_frame_iter) {
3931-
next_instr += 2 + EXTENDED_ARG_OFFSET(oparg);;
3931+
next_instr += 1 + EXTENDED_ARG_OFFSET(oparg);;
39323932
f->f_execute = slp_eval_frame_value;
39333933
goto stackless_iter_return;
39343934
}
39353935
else if (f->f_execute == slp_eval_frame_setup_with) {
3936-
next_instr += 2 + EXTENDED_ARG_OFFSET(oparg);
3936+
next_instr += 1 + EXTENDED_ARG_OFFSET(oparg);
39373937
f->f_execute = slp_eval_frame_value;
39383938
goto stackless_setup_with_return;
39393939
}

0 commit comments

Comments
 (0)