mirror of https://github.com/python/cpython
Patch from jbalogh fixes issue #2282 (misnamed seekable() method).
This commit is contained in:
parent
e84b6336db
commit
ddaa7064ee
|
@ -1203,7 +1203,7 @@ class TextIOWrapper(TextIOBase):
|
||||||
# were rendered by the decoder after feeding it those bytes. We
|
# were rendered by the decoder after feeding it those bytes. We
|
||||||
# use this to reconstruct intermediate decoder states in tell().
|
# use this to reconstruct intermediate decoder states in tell().
|
||||||
|
|
||||||
def _seekable(self):
|
def seekable(self):
|
||||||
return self._seekable
|
return self._seekable
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
|
|
|
@ -895,6 +895,12 @@ class TextIOWrapperTest(unittest.TestCase):
|
||||||
txt.seek(pos)
|
txt.seek(pos)
|
||||||
self.assertEquals(txt.read(4), "BBB\n")
|
self.assertEquals(txt.read(4), "BBB\n")
|
||||||
|
|
||||||
|
def test_issue2282(self):
|
||||||
|
buffer = io.BytesIO(self.testdata)
|
||||||
|
txt = io.TextIOWrapper(buffer, encoding="ascii")
|
||||||
|
|
||||||
|
self.assertEqual(buffer.seekable(), txt.seekable())
|
||||||
|
|
||||||
def test_newline_decoder(self):
|
def test_newline_decoder(self):
|
||||||
import codecs
|
import codecs
|
||||||
decoder = codecs.getincrementaldecoder("utf-8")()
|
decoder = codecs.getincrementaldecoder("utf-8")()
|
||||||
|
|
|
@ -33,6 +33,7 @@ Dwayne Bailey
|
||||||
Stig Bakken
|
Stig Bakken
|
||||||
Greg Ball
|
Greg Ball
|
||||||
Luigi Ballabio
|
Luigi Ballabio
|
||||||
|
Jeff Balogh
|
||||||
Michael J. Barber
|
Michael J. Barber
|
||||||
Chris Barker
|
Chris Barker
|
||||||
Quentin Barnes
|
Quentin Barnes
|
||||||
|
|
|
@ -30,6 +30,8 @@ What's New in Python 3.0a3?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #2282: io.TextIOWrapper was not overriding seekable() from io.IOBase.
|
||||||
|
|
||||||
- Issue #2115: Important speedup in setting __slot__ attributes. Also
|
- Issue #2115: Important speedup in setting __slot__ attributes. Also
|
||||||
prevent a possible crash: an Abstract Base Class would try to access a slot
|
prevent a possible crash: an Abstract Base Class would try to access a slot
|
||||||
on a registered virtual subclass.
|
on a registered virtual subclass.
|
||||||
|
|
Loading…
Reference in New Issue