summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-10 00:04:44 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-10 00:04:44 (GMT)
commited657556086076576050c936947935be0900020d (patch)
tree0865eee9ee94883e2d5ffd5de7f545acdc216480 /Lib/test/test_compile.py
parent28746aba9bf636d03eb1c1c5f4550c6f2dbf5300 (diff)
downloadcpython-ed657556086076576050c936947935be0900020d.zip
cpython-ed657556086076576050c936947935be0900020d.tar.gz
cpython-ed657556086076576050c936947935be0900020d.tar.bz2
Bug #1512814, Fix incorrect lineno's when code at module scope
started after line 256.
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 688a02d..a3f15bf 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -166,6 +166,16 @@ if 1:
pass"""
compile(s, "<string>", "exec")
+ # This test is probably specific to CPython and may not generalize
+ # to other implementations. We are trying to ensure that when
+ # the first line of code starts after 256, correct line numbers
+ # in tracebacks are still produced.
+ def test_leading_newlines(self):
+ s256 = "".join(["\n"] * 256 + ["spam"])
+ co = compile(s256, 'fn', 'exec')
+ self.assertEqual(co.co_firstlineno, 257)
+ self.assertEqual(co.co_lnotab, '')
+
def test_literals_with_leading_zeroes(self):
for arg in ["077787", "0xj", "0x.", "0e", "090000000000000",
"080000000000000", "000000000000009", "000000000000008"]: