]> granicus.if.org Git - python/commitdiff
change Py3k backquote warning to a SyntaxWarning and add a test
authorBenjamin Peterson <benjamin@python.org>
Sun, 8 Jun 2008 02:05:33 +0000 (02:05 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 8 Jun 2008 02:05:33 +0000 (02:05 +0000)
Lib/test/test_py3kwarn.py
Python/ast.c

index 664df449b57eda9b131cab7b1c50c5fee1a44a91..617d996f218b3f050979ec4cc3fffb39824c64b2 100644 (file)
@@ -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:
index 0bc75956e8f6b9961ee27943d93a80da36405670..863906f65aa0af9be8419e4bb820cf53c3a49694 100644 (file)
@@ -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)) {