Index: Python/ast.c =================================================================== --- Python/ast.c (revision 53285) +++ Python/ast.c (working copy) @@ -470,7 +487,7 @@ } static cmpop_ty -ast_for_comp_op(const node *n) +ast_for_comp_op(const node *n, struct compiling *c) { /* comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is' |'is' 'not' @@ -491,6 +508,11 @@ return GtE; case NOTEQUAL: return NotEq; + case NOTEQUALOLD: + if (!ast_warn(n, "use != rather than <>", c->c_filename)) { + return (cmpop_ty)0; + } + return NotEq; case NAME: if (strcmp(STR(n), "in") == 0) return In; @@ -1702,7 +1727,7 @@ for (i = 1; i < NCH(n); i += 2) { cmpop_ty newoperator; - newoperator = ast_for_comp_op(CHILD(n, i)); + newoperator = ast_for_comp_op(CHILD(n, i), c); if (!newoperator) { return NULL; } Index: Include/token.h =================================================================== --- Include/token.h (revision 53285) +++ Include/token.h (working copy) @@ -58,10 +58,11 @@ #define DOUBLESLASH 48 #define DOUBLESLASHEQUAL 49 #define AT 50 +#define NOTEQUALOLD 51 /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ -#define OP 51 -#define ERRORTOKEN 52 -#define N_TOKENS 53 +#define OP 52 +#define ERRORTOKEN 53 +#define N_TOKENS 54 /* Special definitions for cooperation with parser */ Index: Parser/tokenizer.c =================================================================== --- Parser/tokenizer.c (revision 53285) +++ Parser/tokenizer.c (working copy) @@ -72,6 +72,7 @@ "RBRACE", "EQEQUAL", "NOTEQUAL", + "NOTEQUALOLD", "LESSEQUAL", "GREATEREQUAL", "TILDE", @@ -982,7 +983,7 @@ break; case '<': switch (c2) { - case '>': return NOTEQUAL; + case '>': return NOTEQUALOLD; case '=': return LESSEQUAL; case '<': return LEFTSHIFT; }