From: Serhiy Storchaka Date: Sun, 11 Dec 2016 12:43:18 +0000 (+0200) Subject: Issue #28512: Fixed setting the offset attribute of SyntaxError by X-Git-Tag: v3.6.1rc1~325 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8114f21668fe9775d2542d079c6396a745f4f094;p=thirdparty%2FPython%2Fcpython.git Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). --- 8114f21668fe9775d2542d079c6396a745f4f094 diff --cc Lib/test/test_future.py index 213b2ba0755f,7b072ad897bb..2f1c410b1bfa --- a/Lib/test/test_future.py +++ b/Lib/test/test_future.py @@@ -2,9 -2,10 +2,10 @@@ import unittest from test import support + import os import re -rx = re.compile('\((\S+).py, line (\d+)') +rx = re.compile(r'\((\S+).py, line (\d+)') def get_error_location(msg): mo = rx.search(str(msg)) diff --cc Lib/test/test_global.py index 37ec67255a55,37ec67255a55..9eeccf12506f --- a/Lib/test/test_global.py +++ b/Lib/test/test_global.py @@@ -24,7 -24,7 +24,7 @@@ def wrong1() global a global b """ -- check_syntax_error(self, prog_text_1) ++ check_syntax_error(self, prog_text_1, lineno=4, offset=4) def test2(self): prog_text_2 = """\ @@@ -32,7 -32,7 +32,7 @@@ def wrong2() print(x) global x """ -- check_syntax_error(self, prog_text_2) ++ check_syntax_error(self, prog_text_2, lineno=3, offset=4) def test3(self): prog_text_3 = """\ @@@ -41,7 -41,7 +41,7 @@@ def wrong3() x = 2 global x """ -- check_syntax_error(self, prog_text_3) ++ check_syntax_error(self, prog_text_3, lineno=4, offset=4) def test4(self): prog_text_4 = """\ diff --cc Lib/test/test_support.py index 553822b5823e,5e0f990e4000..e83a4d6426a8 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@@ -240,9 -240,10 +240,9 @@@ class TestSupport(unittest.TestCase) self.assertEqual(cm.exception.errno, errno.EBADF) def test_check_syntax_error(self): - support.check_syntax_error(self, "def class") + support.check_syntax_error(self, "def class", lineno=1, offset=9) - self.assertRaises(AssertionError, support.check_syntax_error, self, "1") - #with self.assertRaises(AssertionError): - #support.check_syntax_error(self, "x=1") + with self.assertRaises(AssertionError): + support.check_syntax_error(self, "x=1") def test_CleanImport(self): import importlib diff --cc Lib/test/test_symtable.py index 30471653c36c,fbb1bdc9de45..dfaee173ef72 --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@@ -164,16 -153,16 +164,18 @@@ class SymtableTest(unittest.TestCase) 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): + with self.assertWarns(DeprecationWarning), \ + self.assertRaises(TypeError): symtable.symtable("pass", bytearray(b"spam"), "exec") - symtable.symtable("pass", memoryview(b"spam"), "exec") + with self.assertWarns(DeprecationWarning): + symtable.symtable("pass", memoryview(b"spam"), "exec") with self.assertRaises(TypeError): symtable.symtable("pass", list(b"spam"), "exec") diff --cc Misc/NEWS index 5c323a1038d1,3d664efeb671..8db9170158ba --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -10,12 -10,9 +10,15 @@@ What's New in Python 3.6.1 release cand Core and Builtins ----------------- + - Issue #28512: Fixed setting the offset attribute of SyntaxError by + PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +- Issue #28918: Fix the cross compilation of xxlimited when Python has been + built with Py_DEBUG defined. + +- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. + Improve speed of dict literal with constant keys up to 30%. + - Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas Stührk.