[Python-checkins] r59133 - in python/trunk: Parser/tokenizer.c Python/ast.c
christian.heimes
python-checkins at python.org
Fri Nov 23 13:12:03 CET 2007
Author: christian.heimes
Date: Fri Nov 23 13:12:02 2007
New Revision: 59133
Modified:
python/trunk/Parser/tokenizer.c
python/trunk/Python/ast.c
Log:
Fixed problems in the last commit. Filenames and line numbers weren't reported correctly.
Backquotes still don't report the correct file. The AST nodes only contain the line number but not the file name.
Modified: python/trunk/Parser/tokenizer.c
==============================================================================
--- python/trunk/Parser/tokenizer.c (original)
+++ python/trunk/Parser/tokenizer.c Fri Nov 23 13:12:02 2007
@@ -983,15 +983,7 @@
break;
case '<':
switch (c2) {
- case '>':
- {
-#ifndef PGEN
- if (Py_Py3kWarningFlag)
- PyErr_WarnEx(PyExc_DeprecationWarning,
- "<> not supported in 3.x", 1);
-#endif
- return NOTEQUAL;
- }
+ case '>': return NOTEQUAL;
case '=': return LESSEQUAL;
case '<': return LEFTSHIFT;
}
@@ -1485,6 +1477,16 @@
{
int c2 = tok_nextc(tok);
int token = PyToken_TwoChars(c, c2);
+#ifndef PGEN
+ if (token == NOTEQUAL && c == '<') {
+ if (PyErr_WarnExplicit(PyExc_DeprecationWarning,
+ "<> not supported in 3.x",
+ tok->filename, tok->lineno,
+ NULL, NULL)) {
+ return ERRORTOKEN;
+ }
+ }
+#endif
if (token != OP) {
int c3 = tok_nextc(tok);
int token3 = PyToken_ThreeChars(c, c2, c3);
Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c (original)
+++ python/trunk/Python/ast.c Fri Nov 23 13:12:02 2007
@@ -1336,10 +1336,14 @@
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;
+ if (Py_Py3kWarningFlag) {
+ if (PyErr_WarnExplicit(PyExc_DeprecationWarning,
+ "backquote not supported in 3.x",
+ "<unknown>", LINENO(n),
+ NULL, NULL)) {
+ ; //return NULL;
+ }
+ }
expr_ty expression = ast_for_testlist(c, CHILD(n, 1));
if (!expression)
return NULL;
More information about the Python-checkins
mailing list