]> granicus.if.org Git - python/commitdiff
Applied patch #1754273 and #1754271 from Thomas Glee
authorChristian Heimes <christian@cheimes.de>
Fri, 23 Nov 2007 09:10:36 +0000 (09:10 +0000)
committerChristian Heimes <christian@cheimes.de>
Fri, 23 Nov 2007 09:10:36 +0000 (09:10 +0000)
The patches are adding deprecation warnings for back ticks and <>

Parser/tokenizer.c
Python/ast.c

index 4883f46a67ae0393676e52c0ad901b0936444135..432f94f6f39f38961e304f7af6b7d4995cd5179a 100644 (file)
@@ -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 @@ PyToken_TwoChars(int c1, int c2)
                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;
                }
index 525b5a66f30f2beba51aae7fe28251e7b1261a8e..5555cf7ddf8ae3d2a3f34b8fae51938ff4e38bbb 100644 (file)
@@ -1336,6 +1336,10 @@ ast_for_atom(struct compiling *c, const node *n)
         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;