mirror of
https://github.com/python/cpython.git
synced 2025-12-10 02:50:09 +00:00
Bug #1512814, Fix incorrect lineno's when code at module scope
started after line 256.
This commit is contained in:
parent
28746aba9b
commit
ed65755608
3 changed files with 22 additions and 1 deletions
|
|
@ -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"]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue