summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2014-03-09 21:44:34 (GMT)
committerNed Deily <nad@acm.org>2014-03-09 21:44:34 (GMT)
commit6120739f0cb1c26069570fea701fe79489f1cd9d (patch)
tree30e5a50c465b7ea804d697cf7bec8a9d84658b76 /Lib/test
parent5e572fd490c625193e043ee6e8a9e54900e008b1 (diff)
downloadcpython-6120739f0cb1c26069570fea701fe79489f1cd9d.zip
cpython-6120739f0cb1c26069570fea701fe79489f1cd9d.tar.gz
cpython-6120739f0cb1c26069570fea701fe79489f1cd9d.tar.bz2
Issue #20875: Prevent possible gzip "'read' is not defined" NameError.
Patch by Claudiu Popa.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_gzip.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index c94d54e..034acb0 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -396,6 +396,13 @@ class TestGzip(BaseTest):
with gzip.GzipFile(fileobj=io.BytesIO(gzdata)) as f:
self.assertEqual(f.read(), b'Test')
+ def test_prepend_error(self):
+ # See issue #20875
+ with gzip.open(self.filename, "wb") as f:
+ f.write(data1)
+ with gzip.open(self.filename, "rb") as f:
+ f.fileobj.prepend()
+
class TestOpen(BaseTest):
def test_binary_modes(self):
uncompressed = data1 * 50