diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-22 17:01:13 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-22 17:01:13 (GMT) |
commit | b64d0eba50eeae7fe7ce3b969a8cc80c4578d805 (patch) | |
tree | 0cc759d972ab6789a4dccb359048d79e47b214cc /Lib/codecs.py | |
parent | 37b8200608c8c78b45d41b032aed4f9d9e5c8151 (diff) | |
download | cpython-b64d0eba50eeae7fe7ce3b969a8cc80c4578d805.zip cpython-b64d0eba50eeae7fe7ce3b969a8cc80c4578d805.tar.gz cpython-b64d0eba50eeae7fe7ce3b969a8cc80c4578d805.tar.bz2 |
Merged revisions 81474 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81474 | victor.stinner | 2010-05-22 18:59:09 +0200 (sam., 22 mai 2010) | 20 lines
Merged revisions 81471-81472 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81471 | victor.stinner | 2010-05-22 15:37:56 +0200 (sam., 22 mai 2010) | 7 lines
Issue #6268: More bugfixes about BOM, UTF-16 and UTF-32
* Fix seek() method of codecs.open(), don't write the BOM twice after seek(0)
* Fix reset() method of codecs, UTF-16, UTF-32 and StreamWriter classes
* test_codecs: use "w+" mode instead of "wt+". "t" mode is not supported by
Solaris or Windows, but does it really exist? I found it the in the issue.
........
r81472 | victor.stinner | 2010-05-22 15:44:25 +0200 (sam., 22 mai 2010) | 4 lines
Fix my last commit (r81471) about codecs
Rememder: don't touch the code just before a commit
........
................
Diffstat (limited to 'Lib/codecs.py')
-rw-r--r-- | Lib/codecs.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py index 9490602..f6c2448 100644 --- a/Lib/codecs.py +++ b/Lib/codecs.py @@ -374,6 +374,11 @@ class StreamWriter(Codec): """ pass + def seek(self, offset, whence=0): + self.stream.seek(offset, whence) + if whence == 0 and offset == 0: + self.reset() + def __getattr__(self, name, getattr=getattr): @@ -606,8 +611,8 @@ class StreamReader(Codec): Resets the codec buffers used for keeping state. """ - self.reset() self.stream.seek(offset, whence) + self.reset() def __next__(self): @@ -700,8 +705,10 @@ class StreamReaderWriter: self.writer.reset() def seek(self, offset, whence=0): - self.reader.seek(offset, whence) - self.writer.seek(offset, whence) + self.stream.seek(offset, whence) + self.reader.reset() + if whence == 0 and offset == 0: + self.writer.reset() def __getattr__(self, name, getattr=getattr): |