summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-19 21:14:47 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2007-11-19 21:14:47 (GMT)
commita2d1d7e3b23f6fef0651df1b8fd697aa15ae97c0 (patch)
tree33a629b12c292089dd2811e5139e333bfcbbc806
parent1ff9910f595c1f50e1590caf19e839a917657b36 (diff)
downloadcpython-a2d1d7e3b23f6fef0651df1b8fd697aa15ae97c0.zip
cpython-a2d1d7e3b23f6fef0651df1b8fd697aa15ae97c0.tar.gz
cpython-a2d1d7e3b23f6fef0651df1b8fd697aa15ae97c0.tar.bz2
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.
-rw-r--r--Lib/io.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/io.py b/Lib/io.py
index d2d2fbc..364e6d0 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -1283,7 +1283,7 @@ class TextIOWrapper(TextIOBase):
decoder_buffer, decoder_state = decoder.getstate()
return self._encode_decoder_state(
decoder_state,
- position + (i+1) - len(decoder_buffer))
+ position + (i+1) - len(decoder_buffer) - (n - needed))
raise IOError("Can't reconstruct logical file position")
finally:
decoder.setstate(saved_state)