bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)

Also point to start of tokens in parsing errors.

Fixes bpo-34683
This commit is contained in:
Ammar Askar 2018-09-24 17:12:49 -04:00 committed by Guido van Rossum
parent 223e501fb9
commit 025eb98dc0
11 changed files with 65 additions and 21 deletions

View file

@ -169,7 +169,7 @@ class SymtableTest(unittest.TestCase):
else:
self.fail("no SyntaxError for %r" % (brokencode,))
checkfilename("def f(x): foo)(", 14) # parse-time
checkfilename("def f(x): global x", 10) # symtable-build-time
checkfilename("def f(x): global x", 11) # symtable-build-time
symtable.symtable("pass", b"spam", "exec")
with self.assertWarns(DeprecationWarning), \
self.assertRaises(TypeError):