Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0a697f6

Browse files
committed
BUGFIX! Instructions are unsigned bytes.
1 parent 569fce7 commit 0a697f6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Python/compile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,13 +1803,13 @@ static void
18031803
optimizer(co)
18041804
codeobject *co;
18051805
{
1806-
char *next_instr, *cur_instr;
1806+
unsigned char *next_instr, *cur_instr;
18071807
object *locals;
18081808
int opcode;
18091809
int oparg;
18101810
object *name;
18111811
int star_used;
1812-
1812+
18131813
#define NEXTOP() (*next_instr++)
18141814
#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])
18151815
#define GETITEM(v, i) (getlistitem((v), (i)))
@@ -1821,7 +1821,7 @@ optimizer(co)
18211821
return; /* For now, this is OK */
18221822
}
18231823

1824-
next_instr = GETSTRINGVALUE(co->co_code);
1824+
next_instr = (unsigned char *) GETSTRINGVALUE(co->co_code);
18251825
for (;;) {
18261826
opcode = NEXTOP();
18271827
if (opcode == STOP_CODE)
@@ -1838,7 +1838,7 @@ optimizer(co)
18381838
}
18391839

18401840
star_used = (dictlookup(locals, "*") != NULL);
1841-
next_instr = GETSTRINGVALUE(co->co_code);
1841+
next_instr = (unsigned char *) GETSTRINGVALUE(co->co_code);
18421842
for (;;) {
18431843
cur_instr = next_instr;
18441844
opcode = NEXTOP();

0 commit comments

Comments
 (0)