summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_symtable.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-11 12:39:01 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-11 12:39:01 (GMT)
commit8b58339eb2939da4df822f7ea457b44e120fad45 (patch)
treed34029d80314da5bea6e6fccbc9f07e74fa50457 /Lib/test/test_symtable.py
parent49c14d8e8fe8f1897eef72ef45665b7afeec32d6 (diff)
downloadcpython-8b58339eb2939da4df822f7ea457b44e120fad45.zip
cpython-8b58339eb2939da4df822f7ea457b44e120fad45.tar.gz
cpython-8b58339eb2939da4df822f7ea457b44e120fad45.tar.bz2
Issue #28512: Fixed setting the offset attribute of SyntaxError by
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
Diffstat (limited to 'Lib/test/test_symtable.py')
-rw-r--r--Lib/test/test_symtable.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py
index c5d7fac..fbb1bdc 100644
--- a/Lib/test/test_symtable.py
+++ b/Lib/test/test_symtable.py
@@ -148,15 +148,17 @@ class SymtableTest(unittest.TestCase):
def test_filename_correct(self):
### Bug tickler: SyntaxError file name correct whether error raised
### while parsing or building symbol table.
- def checkfilename(brokencode):
+ def checkfilename(brokencode, offset):
try:
symtable.symtable(brokencode, "spam", "exec")
except SyntaxError as e:
self.assertEqual(e.filename, "spam")
+ self.assertEqual(e.lineno, 1)
+ self.assertEqual(e.offset, offset)
else:
self.fail("no SyntaxError for %r" % (brokencode,))
- checkfilename("def f(x): foo)(") # parse-time
- checkfilename("def f(x): global x") # symtable-build-time
+ checkfilename("def f(x): foo)(", 14) # parse-time
+ checkfilename("def f(x): global x", 10) # symtable-build-time
symtable.symtable("pass", b"spam", "exec")
with self.assertRaises(TypeError):
symtable.symtable("pass", bytearray(b"spam"), "exec")