[Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.109, 1.1.2.110
bcannon@users.sourceforge.net
bcannon at users.sourceforge.net
Thu Jul 28 07:50:04 CEST 2005
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31317/Python
Modified Files:
Tag: ast-branch
newcompile.c
Log Message:
Fix the creation of lnotab to emit ``\x00x01`` for the first line of code (such
as def statements). Causes test_dis:test_dis to pass.
Partially fixes bug #1246473.
Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.109
retrieving revision 1.1.2.110
diff -u -d -r1.1.2.109 -r1.1.2.110
--- newcompile.c 11 Jul 2005 03:43:56 -0000 1.1.2.109
+++ newcompile.c 28 Jul 2005 05:50:01 -0000 1.1.2.110
@@ -3339,17 +3339,22 @@
a->a_lnotab_off += ncodes * 2;
}
- if (d_bytecode) {
- len = PyString_GET_SIZE(a->a_lnotab);
- if (a->a_lnotab_off + 2 >= len) {
- if (_PyString_Resize(&a->a_lnotab, len * 2) < 0)
- return 0;
- }
- lnotab = PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
- a->a_lnotab_off += 2;
+ len = PyString_GET_SIZE(a->a_lnotab);
+ if (a->a_lnotab_off + 2 >= len) {
+ if (_PyString_Resize(&a->a_lnotab, len * 2) < 0)
+ return 0;
+ }
+ lnotab = PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
+
+ a->a_lnotab_off += 2;
+ if (d_bytecode) {
*lnotab++ = d_bytecode;
*lnotab++ = d_lineno;
}
+ else { /* First line of a block; def stmt, etc. */
+ *lnotab++ = 0;
+ *lnotab++ = 1;
+ }
a->a_lineno = i->i_lineno;
a->a_lineno_off = a->a_offset;
return 1;
More information about the Python-checkins
mailing list