summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKa-Ping Yee <ping@zesty.ca>2008-03-17 20:35:15 (GMT)
committerKa-Ping Yee <ping@zesty.ca>2008-03-17 20:35:15 (GMT)
commitddaa7064ee81c48adc4fdea327892c29179f7845 (patch)
treee51842456cd053a08607b590f7a8303068be56bd
parente84b6336db4a2521de91aa916676bdf494aa8205 (diff)
downloadcpython-ddaa7064ee81c48adc4fdea327892c29179f7845.zip
cpython-ddaa7064ee81c48adc4fdea327892c29179f7845.tar.gz
cpython-ddaa7064ee81c48adc4fdea327892c29179f7845.tar.bz2
Patch from jbalogh fixes issue #2282 (misnamed seekable() method).
-rw-r--r--Lib/io.py2
-rw-r--r--Lib/test/test_io.py6
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS2
4 files changed, 10 insertions, 1 deletions
diff --git a/Lib/io.py b/Lib/io.py
index 24bf37b..98843d3 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -1203,7 +1203,7 @@ class TextIOWrapper(TextIOBase):
# were rendered by the decoder after feeding it those bytes. We
# use this to reconstruct intermediate decoder states in tell().
- def _seekable(self):
+ def seekable(self):
return self._seekable
def flush(self):
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 4963416..0bc2b48 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -895,6 +895,12 @@ class TextIOWrapperTest(unittest.TestCase):
txt.seek(pos)
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):
import codecs
decoder = codecs.getincrementaldecoder("utf-8")()
diff --git a/Misc/ACKS b/Misc/ACKS
index 0c431c0..1ae773f 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -33,6 +33,7 @@ Dwayne Bailey
Stig Bakken
Greg Ball
Luigi Ballabio
+Jeff Balogh
Michael J. Barber
Chris Barker
Quentin Barnes
diff --git a/Misc/NEWS b/Misc/NEWS
index b654516..1665256 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -30,6 +30,8 @@ What's New in Python 3.0a3?
Core and Builtins
-----------------
+- Issue #2282: io.TextIOWrapper was not overriding seekable() from io.IOBase.
+
- Issue #2115: Important speedup in setting __slot__ attributes. Also
prevent a possible crash: an Abstract Base Class would try to access a slot
on a registered virtual subclass.