Fix seekable() in BZ2File and LZMAFile to check whether the underlying file supports seek().
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 0f8d149..cc416ed 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -372,6 +372,15 @@
bz2f.close()
self.assertRaises(ValueError, bz2f.seekable)
+ src = BytesIO(self.DATA)
+ src.seekable = lambda: False
+ bz2f = BZ2File(fileobj=src)
+ try:
+ self.assertFalse(bz2f.seekable())
+ finally:
+ bz2f.close()
+ self.assertRaises(ValueError, bz2f.seekable)
+
def testReadable(self):
bz2f = BZ2File(fileobj=BytesIO(self.DATA))
try: