[Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.118, 1.1.2.119
nascheme@users.sourceforge.net
nascheme at users.sourceforge.net
Thu Oct 13 06:46:02 CEST 2005
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12137/Python
Modified Files:
Tag: ast-branch
newcompile.c
Log Message:
The line number for the first instruction of a unit may not be
co_firstlineno. Fix that. Also, set firstlineno properly for
Lambda and GenExpr nodes.
Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.118
retrieving revision 1.1.2.119
diff -u -d -r1.1.2.118 -r1.1.2.119
--- newcompile.c 13 Oct 2005 00:32:45 -0000 1.1.2.118
+++ newcompile.c 13 Oct 2005 04:45:58 -0000 1.1.2.119
@@ -2150,7 +2150,7 @@
if (args->defaults)
VISIT_SEQ(c, expr, args->defaults);
- if (!compiler_enter_scope(c, name, (void *)e, c->u->u_lineno))
+ if (!compiler_enter_scope(c, name, (void *)e, e->lineno))
return 0;
/* unpack nested arguments */
@@ -3293,7 +3293,7 @@
if (!name)
return 0;
- if (!compiler_enter_scope(c, name, (void *)e, c->u->u_lineno))
+ if (!compiler_enter_scope(c, name, (void *)e, e->lineno))
return 0;
compiler_genexp_generator(c, e->v.GeneratorExp.generators, 0,
e->v.GeneratorExp.elt);
@@ -3797,10 +3797,10 @@
}
static int
-assemble_init(struct assembler *a, int nblocks)
+assemble_init(struct assembler *a, int nblocks, int firstlineno)
{
memset(a, 0, sizeof(struct assembler));
- a->a_lineno = 1;
+ a->a_lineno = firstlineno;
a->a_bytecode = PyString_FromStringAndSize(NULL, DEFAULT_CODE_SIZE);
if (!a->a_bytecode)
return 0;
@@ -3987,7 +3987,7 @@
}
else { /* First line of a block; def stmt, etc. */
*lnotab++ = 0;
- *lnotab++ = 1;
+ *lnotab++ = d_lineno;
}
a->a_lineno = i->i_lineno;
a->a_lineno_off = a->a_offset;
@@ -4226,7 +4226,7 @@
entryblock = b;
}
- if (!assemble_init(&a, nblocks))
+ if (!assemble_init(&a, nblocks, c->u->u_firstlineno))
goto error;
dfs(c, entryblock, &a);
More information about the Python-checkins
mailing list