]> granicus.if.org Git - python/commitdiff
Revert bb62908896fe, but keep the test
authorJesus Cea <jcea@jcea.es>
Mon, 25 Apr 2011 02:03:58 +0000 (04:03 +0200)
committerJesus Cea <jcea@jcea.es>
Mon, 25 Apr 2011 02:03:58 +0000 (04:03 +0200)
Parser/tokenizer.c

index f7ca59823285163d6bb6ddebe5f0256cfdcfe993..f4d7e3fc683218b5e942c67358cd13a3dc900218 100644 (file)
@@ -585,19 +585,12 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
     if (badchar) {
         /* Need to add 1 to the line number, since this line
            has not been counted, yet.  */
-        if (tok->filename != NULL)
-            filename = PyUnicode_DecodeFSDefault(tok->filename);
-        else
-            filename = PyUnicode_FromString("<file>");
-        if (filename != NULL) {
-            PyErr_Format(PyExc_SyntaxError,
-                    "Non-UTF-8 code starting with '\\x%.2x' "
-                    "in file %U on line %i, "
-                    "but no encoding declared; "
-                    "see http://python.org/dev/peps/pep-0263/ for details",
-                    badchar, filename, tok->lineno + 1);
-            Py_DECREF(filename);
-        }
+        PyErr_Format(PyExc_SyntaxError,
+                "Non-UTF-8 code starting with '\\x%.2x' "
+                "in file %U on line %i, "
+                "but no encoding declared; "
+                "see http://python.org/dev/peps/pep-0263/ for details",
+                badchar, tok->filename, tok->lineno + 1);
         return error_ret(tok);
     }
 #endif