[Python-checkins] r60584 - in python/trunk: Lib/test/test_trace.py Python/compile.c
amaury.forgeotdarc
python-checkins at python.org
Tue Feb 5 01:26:22 CET 2008
Author: amaury.forgeotdarc
Date: Tue Feb 5 01:26:21 2008
New Revision: 60584
Modified:
python/trunk/Lib/test/test_trace.py
python/trunk/Python/compile.c
Log:
Change r60575 broke test_compile:
there is no need to emit co_lnotab item when both offsets are zeros.
Modified: python/trunk/Lib/test/test_trace.py
==============================================================================
--- python/trunk/Lib/test/test_trace.py (original)
+++ python/trunk/Lib/test/test_trace.py Tue Feb 5 01:26:21 2008
@@ -366,6 +366,15 @@
(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
Modified: python/trunk/Python/compile.c
==============================================================================
--- python/trunk/Python/compile.c (original)
+++ python/trunk/Python/compile.c Tue Feb 5 01:26:21 2008
@@ -3560,6 +3560,9 @@
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;
More information about the Python-checkins
mailing list