Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2d1d7e

Browse files
committed
Oops, I missed this one again (test_univnewlines fails):
Some incremental decoders return multiple characters, even when fed with only one more byte. In this case the tell() state must subtract the number of extra characters.
1 parent 1ff9910 commit a2d1d7e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ def tell(self):
12831283
decoder_buffer, decoder_state = decoder.getstate()
12841284
return self._encode_decoder_state(
12851285
decoder_state,
1286-
position + (i+1) - len(decoder_buffer))
1286+
position + (i+1) - len(decoder_buffer) - (n - needed))
12871287
raise IOError("Can't reconstruct logical file position")
12881288
finally:
12891289
decoder.setstate(saved_state)

0 commit comments

Comments
 (0)