]> granicus.if.org Git - python/commitdiff
Patch from jbalogh fixes issue #2282 (misnamed seekable() method).
authorKa-Ping Yee <ping@zesty.ca>
Mon, 17 Mar 2008 20:35:15 +0000 (20:35 +0000)
committerKa-Ping Yee <ping@zesty.ca>
Mon, 17 Mar 2008 20:35:15 +0000 (20:35 +0000)
Lib/io.py
Lib/test/test_io.py
Misc/ACKS
Misc/NEWS

index 24bf37bff1af916d17d9c86462d5a4e8e45b7471..98843d381642468bee7ca9ca83d35d9678596af3 100644 (file)
--- 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):
index 4963416ffaaae6d5a4f8b9a156bcdb272a56d9e6..0bc2b48bbc46926152f70be86eec6e7387bdcd52 100644 (file)
@@ -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")()
index 0c431c0383a767381a4bea924f1751731163c1f7..1ae773f7cd5e8a6083c04fee16048e13f4b6f121 100644 (file)
--- 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
index b654516113b99adaaa345944e0955846e2ae9978..16652569c56f71180df5a82e513c43babd35c824 100644 (file)
--- 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.