value.
(fixes error in patch for issue #18960)
text, charset, 4)
do_test("#!shebang\n# coding: {0}\n".format(charset),
text, charset, 5)
+ do_test(" \t\f\n# coding: {0}\n".format(charset),
+ text, charset, 5)
+ # Issue #18960: coding spec should has no effect
+ do_test("0\n# coding: GBK\n", "h\xe9 ho", 'utf-8', 5)
class TracebackFormatTests(unittest.TestCase):
readline = _PyObject_GetAttrId(stream, &PyId_readline);
tok->decoding_readline = readline;
- /* The file has been reopened; parsing will restart from
- * the beginning of the file, we have to reset the line number.
- * But this function has been called from inside tok_nextc() which
- * will increment lineno before it returns. So we set it -1 so that
- * the next call to tok_nextc() will start with tok->lineno == 0.
- */
- tok->lineno = -1;
-
cleanup:
Py_XDECREF(stream);
Py_XDECREF(io);