Commit 10e9b726 authored by Amaury Forgeot d'Arc's avatar Amaury Forgeot d'Arc

Change r60575 broke test_compile:

there is no need to emit co_lnotab item when both offsets are zeros.
parent d622d7db
......@@ -366,6 +366,15 @@ class TraceTestCase(unittest.TestCase):
(3, 'line'),
(3, 'return')])
def test_16_blank_lines(self):
exec("def f():\n" + "\n" * 256 + " pass")
self.run_and_compare(
f,
[(0, 'call'),
(257, 'line'),
(257, 'return')])
class RaisingTraceFuncTestCase(unittest.TestCase):
def trace(self, frame, event, arg):
"""A trace function that raises an exception in response to a
......
......@@ -3560,6 +3560,9 @@ assemble_lnotab(struct assembler *a, struct instr *i)
assert(d_bytecode >= 0);
assert(d_lineno >= 0);
if(d_bytecode == 0 && d_lineno == 0)
return 1;
if (d_bytecode > 255) {
int j, nbytes, ncodes = d_bytecode / 255;
nbytes = a->a_lnotab_off + 2 * ncodes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment