BUGFIX! Instructions are unsigned bytes.

This commit is contained in:
Guido van Rossum 1991-04-16 08:39:12 +00:00
parent 569fce7901
commit 0a697f686f
1 changed files with 4 additions and 4 deletions

View File

@ -1803,13 +1803,13 @@ static void
optimizer(co) optimizer(co)
codeobject *co; codeobject *co;
{ {
char *next_instr, *cur_instr; unsigned char *next_instr, *cur_instr;
object *locals; object *locals;
int opcode; int opcode;
int oparg; int oparg;
object *name; object *name;
int star_used; int star_used;
#define NEXTOP() (*next_instr++) #define NEXTOP() (*next_instr++)
#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2]) #define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])
#define GETITEM(v, i) (getlistitem((v), (i))) #define GETITEM(v, i) (getlistitem((v), (i)))
@ -1821,7 +1821,7 @@ optimizer(co)
return; /* For now, this is OK */ return; /* For now, this is OK */
} }
next_instr = GETSTRINGVALUE(co->co_code); next_instr = (unsigned char *) GETSTRINGVALUE(co->co_code);
for (;;) { for (;;) {
opcode = NEXTOP(); opcode = NEXTOP();
if (opcode == STOP_CODE) if (opcode == STOP_CODE)
@ -1838,7 +1838,7 @@ optimizer(co)
} }
star_used = (dictlookup(locals, "*") != NULL); star_used = (dictlookup(locals, "*") != NULL);
next_instr = GETSTRINGVALUE(co->co_code); next_instr = (unsigned char *) GETSTRINGVALUE(co->co_code);
for (;;) { for (;;) {
cur_instr = next_instr; cur_instr = next_instr;
opcode = NEXTOP(); opcode = NEXTOP();