mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Do not reset the line number because we already set file position to correct
value. (fixes error in patch for issue #18960)
This commit is contained in:
parent
50b82c765f
commit
1064a13bb0
2 changed files with 4 additions and 8 deletions
|
@ -514,14 +514,6 @@ fp_setreadl(struct tok_state *tok, const char* enc)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue