[Python-checkins] r59132 - in python/trunk: Parser/tokenizer.c Python/ast.c

christian.heimes python-checkins at python.org
Fri Nov 23 10:10:36 CET 2007


Author: christian.heimes
Date: Fri Nov 23 10:10:36 2007
New Revision: 59132

Modified:
   python/trunk/Parser/tokenizer.c
   python/trunk/Python/ast.c
Log:
Applied patch #1754273 and #1754271 from Thomas Glee
The patches are adding deprecation warnings for back ticks and <>

Modified: python/trunk/Parser/tokenizer.c
==============================================================================
--- python/trunk/Parser/tokenizer.c	(original)
+++ python/trunk/Parser/tokenizer.c	Fri Nov 23 10:10:36 2007
@@ -16,6 +16,7 @@
 #include "fileobject.h"
 #include "codecs.h"
 #include "abstract.h"
+#include "pydebug.h"
 #endif /* PGEN */
 
 extern char *PyOS_Readline(FILE *, FILE *, char *);
@@ -982,7 +983,15 @@
 		break;
 	case '<':
 		switch (c2) {
-		case '>':	return NOTEQUAL;
+		case '>':
+			{
+#ifndef PGEN
+				if (Py_Py3kWarningFlag)
+					PyErr_WarnEx(PyExc_DeprecationWarning,
+						"<> not supported in 3.x", 1);
+#endif
+				return NOTEQUAL;
+			}
 		case '=':	return LESSEQUAL;
 		case '<':	return LEFTSHIFT;
 		}

Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c	(original)
+++ python/trunk/Python/ast.c	Fri Nov 23 10:10:36 2007
@@ -1336,6 +1336,10 @@
         return Dict(keys, values, LINENO(n), n->n_col_offset, c->c_arena);
     }
     case BACKQUOTE: { /* repr */
+        if (Py_Py3kWarningFlag &&
+            PyErr_Warn(PyExc_DeprecationWarning,
+                "backquote not supported in 3.x") < 0)
+            return NULL;
         expr_ty expression = ast_for_testlist(c, CHILD(n, 1));
         if (!expression)
             return NULL;


More information about the Python-checkins mailing list