summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-16 01:50:38 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-16 01:50:38 (GMT)
commit84be93b2db7e8c351bc5f25991c14a1384b5b523 (patch)
tree5f96b1585c52ccbc422aa01372a51862b326d9bf /Python/compile.c
parentec5948aae223e8f4d1ffd86f9eea92aa5ebe7304 (diff)
downloadcpython-84be93b2db7e8c351bc5f25991c14a1384b5b523.zip
cpython-84be93b2db7e8c351bc5f25991c14a1384b5b523.tar.gz
cpython-84be93b2db7e8c351bc5f25991c14a1384b5b523.tar.bz2
Bug #1512814, Fix incorrect lineno's when code within a function
had more than 255 blank lines. Byte codes need to go first, line #s second.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Python/compile.c b/Python/compile.c
index a96a503..8341cc9 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -4098,9 +4098,10 @@ corresponding to a bytecode address A should do something like this
In order for this to work, when the addr field increments by more than 255,
the line # increment in each pair generated must be 0 until the remaining addr
-increment is < 256. So, in the example above, com_set_lineno should not (as
-was actually done until 2.2) expand 300, 300 to 255, 255, 45, 45, but to
-255, 0, 45, 255, 0, 45.
+increment is < 256. So, in the example above, assemble_lnotab (it used
+to be called com_set_lineno) should not (as was actually done until 2.2)
+expand 300, 300 to 255, 255, 45, 45,
+ but to 255, 0, 45, 255, 0, 45.
*/
static int
@@ -4155,12 +4156,12 @@ assemble_lnotab(struct assembler *a, struct instr *i)
}
lnotab = (unsigned char *)
PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off;
- *lnotab++ = 255;
*lnotab++ = d_bytecode;
+ *lnotab++ = 255;
d_bytecode = 0;
for (j = 1; j < ncodes; j++) {
- *lnotab++ = 255;
*lnotab++ = 0;
+ *lnotab++ = 255;
}
d_lineno -= ncodes * 255;
a->a_lnotab_off += ncodes * 2;