Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 39094:756d57acda85 legacy-trunk
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.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 16 Jul 2006 01:50:38 +0000 |
| parents | ca3d9a67126b |
| children | 7c09b66f04bd |
line wrap: on
line diff
--- a/Python/compile.c Sun Jul 16 01:21:20 2006 +0000 +++ b/Python/compile.c Sun Jul 16 01:50:38 2006 +0000 @@ -4098,9 +4098,10 @@ 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 @@ } lnotab = (unsigned char *) PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + *lnotab++ = d_bytecode; *lnotab++ = 255; - *lnotab++ = d_bytecode; d_bytecode = 0; for (j = 1; j < ncodes; j++) { + *lnotab++ = 0; *lnotab++ = 255; - *lnotab++ = 0; } d_lineno -= ncodes * 255; a->a_lnotab_off += ncodes * 2;
