[Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.74,
1.1.2.75
jhylton at users.sourceforge.net
jhylton at users.sourceforge.net
Mon Feb 16 17:11:39 EST 2004
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18239
Modified Files:
Tag: ast-branch
newcompile.c
Log Message:
Fix for lnotab generation. (See last line of patch.)
The offset of the last bytecode with a line number wasn't being
updated, so the lnotab was generating bogus values with very large
address increments.
Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.74
retrieving revision 1.1.2.75
diff -C2 -d -r1.1.2.74 -r1.1.2.75
*** newcompile.c 16 Feb 2004 04:07:24 -0000 1.1.2.74
--- newcompile.c 16 Feb 2004 22:11:34 -0000 1.1.2.75
***************
*** 42,45 ****
--- 42,47 ----
#: yield or return outside a function don't raise a SyntaxError
#: line numbers are off a bit (may just need to add calls to set lineno)
+ In some cases, the line numbers for generated code aren't strictly
+ increasing. This breaks the lnotab.
#: Modules/parsermodule.c:496: warning: implicit declaration
of function `PyParser_SimpleParseString'
***************
*** 582,586 ****
c->u->u_lineno_set = true;
b = c->u->u_blocks[c->u->u_curblock];
! b->b_instr[off].i_lineno = c->u->u_lineno;
}
--- 584,588 ----
c->u->u_lineno_set = true;
b = c->u->u_blocks[c->u->u_curblock];
! b->b_instr[off].i_lineno = c->u->u_lineno;
}
***************
*** 594,598 ****
if (off < 0)
return 0;
- compiler_set_lineno(c, off);
b = c->u->u_blocks[c->u->u_curblock];
i = &b->b_instr[off];
--- 596,599 ----
***************
*** 601,604 ****
--- 602,606 ----
if (opcode == RETURN_VALUE)
b->b_return = 1;
+ compiler_set_lineno(c, off);
return 1;
}
***************
*** 650,658 ****
if (off < 0)
return 0;
- compiler_set_lineno(c, off);
i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off];
i->i_opcode = opcode;
i->i_oparg = oparg;
i->i_hasarg = 1;
return 1;
}
--- 652,660 ----
if (off < 0)
return 0;
i = &c->u->u_blocks[c->u->u_curblock]->b_instr[off];
i->i_opcode = opcode;
i->i_oparg = oparg;
i->i_hasarg = 1;
+ compiler_set_lineno(c, off);
return 1;
}
***************
*** 2442,2445 ****
--- 2444,2452 ----
d_lineno = i->i_lineno - a->a_lineno;
+ /* setup.py's get_platform() causes these asserts to fail.
+ assert(d_bytecode >= 0);
+ assert(d_lineno >= 0);
+ */
+
if (d_lineno == 0)
return 1;
***************
*** 2502,2505 ****
--- 2509,2513 ----
}
a->a_lineno = i->i_lineno;
+ a->a_lineno_off = a->a_offset;
return 1;
}
More information about the Python-checkins
mailing list