Skip to content

Commit c1935d2

Browse files
committed
Revert bb62908896fe, but keep the test
1 parent 4f71172 commit c1935d2

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

Parser/tokenizer.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -585,19 +585,12 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
585585
if (badchar) {
586586
/* Need to add 1 to the line number, since this line
587587
has not been counted, yet. */
588-
if (tok->filename != NULL)
589-
filename = PyUnicode_DecodeFSDefault(tok->filename);
590-
else
591-
filename = PyUnicode_FromString("<file>");
592-
if (filename != NULL) {
593-
PyErr_Format(PyExc_SyntaxError,
594-
"Non-UTF-8 code starting with '\\x%.2x' "
595-
"in file %U on line %i, "
596-
"but no encoding declared; "
597-
"see http://python.org/dev/peps/pep-0263/ for details",
598-
badchar, filename, tok->lineno + 1);
599-
Py_DECREF(filename);
600-
}
588+
PyErr_Format(PyExc_SyntaxError,
589+
"Non-UTF-8 code starting with '\\x%.2x' "
590+
"in file %U on line %i, "
591+
"but no encoding declared; "
592+
"see http://python.org/dev/peps/pep-0263/ for details",
593+
badchar, tok->filename, tok->lineno + 1);
601594
return error_ret(tok);
602595
}
603596
#endif

0 commit comments

Comments
 (0)