diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-11 12:43:18 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-11 12:43:18 (GMT) |
| commit | 8114f21668fe9775d2542d079c6396a745f4f094 (patch) | |
| tree | 62ef9087e76229ea0fd18d0a1052abd79c9ae2f3 /Lib/test/test_symtable.py | |
| parent | 0a7b8596c075b3d69e2fae3c71746415ba3bad39 (diff) | |
| parent | 8b58339eb2939da4df822f7ea457b44e120fad45 (diff) | |
| download | cpython-8114f21668fe9775d2542d079c6396a745f4f094.zip cpython-8114f21668fe9775d2542d079c6396a745f4f094.tar.gz cpython-8114f21668fe9775d2542d079c6396a745f4f094.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.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py index 3047165..dfaee17 100644 --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -159,15 +159,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.assertWarns(DeprecationWarning), \ self.assertRaises(TypeError): |
