summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-01-18 13:53:05 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-01-18 13:53:05 (GMT)
commit9fbec7ad5e8fcdd9dcc5abd496341b86d12a4472 (patch)
treedeb922b10d5de919bd8387cfcfa5dea37cd76aa9 /Lib/test/test_tarfile.py
parent53ad0cd2842b7327bde4ca04ee11c544e522ff43 (diff)
downloadcpython-9fbec7ad5e8fcdd9dcc5abd496341b86d12a4472.zip
cpython-9fbec7ad5e8fcdd9dcc5abd496341b86d12a4472.tar.gz
cpython-9fbec7ad5e8fcdd9dcc5abd496341b86d12a4472.tar.bz2
Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't
write complete output on close.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 6986fc0..ceaa3aa 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -855,6 +855,12 @@ class WriteTestBase(TarTest):
tar.addfile(tarfile.TarInfo("foo"))
tar.close()
self.assertFalse(fobj.closed, "external fileobjs must never closed")
+ # Issue #20238: Incomplete gzip output with mode="w:gz"
+ data = fobj.getvalue()
+ del tar
+ support.gc_collect()
+ self.assertFalse(fobj.closed)
+ self.assertEqual(data, fobj.getvalue())
class WriteTest(WriteTestBase, unittest.TestCase):