diff options
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 0d3f974c07..c1bdac7913 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -2295,7 +2295,7 @@ class TextIOWrapper(TextIOBase): return not eof def _pack_cookie(self, position, dec_flags=0, - bytes_to_feed=0, need_eof=0, chars_to_skip=0): + bytes_to_feed=0, need_eof=False, chars_to_skip=0): # The meaning of a tell() cookie is: seek to position, set the # decoder flags to dec_flags, read bytes_to_feed bytes, feed them # into the decoder with need_eof as the EOF flag, then skip @@ -2309,7 +2309,7 @@ class TextIOWrapper(TextIOBase): rest, dec_flags = divmod(rest, 1<<64) rest, bytes_to_feed = divmod(rest, 1<<64) need_eof, chars_to_skip = divmod(rest, 1<<64) - return position, dec_flags, bytes_to_feed, need_eof, chars_to_skip + return position, dec_flags, bytes_to_feed, bool(need_eof), chars_to_skip def tell(self): if not self._seekable: @@ -2383,7 +2383,7 @@ class TextIOWrapper(TextIOBase): # (a point where the decoder has nothing buffered, so seek() # can safely start from there and advance to this location). bytes_fed = 0 - need_eof = 0 + need_eof = False # Chars decoded since `start_pos` chars_decoded = 0 for i in range(skip_bytes, len(next_input)): @@ -2400,7 +2400,7 @@ class TextIOWrapper(TextIOBase): else: # We didn't get enough decoded data; signal EOF to get more. chars_decoded += len(decoder.decode(b'', final=True)) - need_eof = 1 + need_eof = True if chars_decoded < chars_to_skip: raise OSError("can't reconstruct logical file position") |