[Python-checkins] r64031 - in python/trunk: Lib/test/test_py3kwarn.py Python/ast.c
benjamin.peterson
python-checkins at python.org
Sun Jun 8 04:05:34 CEST 2008
Author: benjamin.peterson
Date: Sun Jun 8 04:05:33 2008
New Revision: 64031
Log:
change Py3k backquote warning to a SyntaxWarning and add a test
Modified:
python/trunk/Lib/test/test_py3kwarn.py
python/trunk/Python/ast.c
Modified: python/trunk/Lib/test/test_py3kwarn.py
==============================================================================
--- python/trunk/Lib/test/test_py3kwarn.py (original)
+++ python/trunk/Lib/test/test_py3kwarn.py Sun Jun 8 04:05:33 2008
@@ -10,6 +10,12 @@
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:
Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c (original)
+++ python/trunk/Python/ast.c Sun Jun 8 04:05:33 2008
@@ -1364,7 +1364,7 @@
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)) {
More information about the Python-checkins
mailing list