summaryrefslogtreecommitdiff
path: root/Parser/tokenizer.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-23 12:12:02 +0000
committerChristian Heimes <christian@cheimes.de>2007-11-23 12:12:02 +0000
commit02c9ab568d1458e4c1ea2ca700c5d25bb31e8002 (patch)
treeedf8d08a2f2aea45d78c32c95ece0c825fcfa32d /Parser/tokenizer.c
parent729ab15370c8e7781f4781428364d203eb9f6416 (diff)
downloadcpython-git-02c9ab568d1458e4c1ea2ca700c5d25bb31e8002.tar.gz
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.
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r--Parser/tokenizer.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 432f94f6f3..4ff2b98589 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -983,15 +983,7 @@ PyToken_TwoChars(int c1, int c2)
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 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
{
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);