From 2fe3ef8750e7f06ebf250bb2264f71d5f96e2f9b Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 8 Jun 2008 02:05:33 +0000 Subject: [PATCH] change Py3k backquote warning to a SyntaxWarning and add a test --- Lib/test/test_py3kwarn.py | 6 ++++++ Python/ast.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 664df449b5..617d996f21 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -10,6 +10,12 @@ if not sys.py3kwarning: class TestPy3KWarnings(unittest.TestCase): + def test_backquote(self): + expected = 'backquote not supported in 3.x; use repr()' + with catch_warning() as w: + exec "`2`" in {} + self.assertWarning(None, w, expected) + def test_type_inequality_comparisons(self): expected = 'type inequality comparisons not supported in 3.x' with catch_warning() as w: diff --git a/Python/ast.c b/Python/ast.c index 0bc75956e8..863906f65a 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1364,7 +1364,7 @@ ast_for_atom(struct compiling *c, const node *n) case BACKQUOTE: { /* repr */ expr_ty expression; if (Py_Py3kWarningFlag) { - if (PyErr_WarnExplicit(PyExc_DeprecationWarning, + if (PyErr_WarnExplicit(PyExc_SyntaxWarning, "backquote not supported in 3.x; use repr()", c->c_filename, LINENO(n), NULL, NULL)) { -- 2.40.0