diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-16 01:50:38 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-16 01:50:38 +0000 |
commit | 84be93b2db7e8c351bc5f25991c14a1384b5b523 (patch) | |
tree | 5f96b1585c52ccbc422aa01372a51862b326d9bf /Python/compile.c | |
parent | ec5948aae223e8f4d1ffd86f9eea92aa5ebe7304 (diff) | |
download | cpython-git-84be93b2db7e8c351bc5f25991c14a1384b5b523.tar.gz |
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.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Python/compile.c b/Python/compile.c index a96a503723..8341cc93bb 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; |