mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
No need to emit co_lnotab item when both offsets are zeros.
r60579 broke a test test_compile, which seems to test an "implementation detail" IMO. Also test that this correction does not impact the debugger.
This commit is contained in:
parent
dcf84003c1
commit
bc212104e4
2 changed files with 12 additions and 0 deletions
|
@ -352,6 +352,15 @@ class TraceTestCase(unittest.TestCase):
|
||||||
(3, 'line'),
|
(3, 'line'),
|
||||||
(3, 'return')])
|
(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):
|
class RaisingTraceFuncTestCase(unittest.TestCase):
|
||||||
def trace(self, frame, event, arg):
|
def trace(self, frame, event, arg):
|
||||||
"""A trace function that raises an exception in response to a
|
"""A trace function that raises an exception in response to a
|
||||||
|
|
|
@ -4191,6 +4191,9 @@ assemble_lnotab(struct assembler *a, struct instr *i)
|
||||||
assert(d_bytecode >= 0);
|
assert(d_bytecode >= 0);
|
||||||
assert(d_lineno >= 0);
|
assert(d_lineno >= 0);
|
||||||
|
|
||||||
|
if(d_bytecode == 0 && d_lineno == 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (d_bytecode > 255) {
|
if (d_bytecode > 255) {
|
||||||
int j, nbytes, ncodes = d_bytecode / 255;
|
int j, nbytes, ncodes = d_bytecode / 255;
|
||||||
nbytes = a->a_lnotab_off + 2 * ncodes;
|
nbytes = a->a_lnotab_off + 2 * ncodes;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue