diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-01-18 09:25:58 +0200 |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-01-18 09:25:58 +0200 |
commit | 863f02a6442a270877e94eb8980c80692b779ed1 (patch) | |
tree | 7e612992f2ddd8c2f98efc78199f13ff567461b5 /Lib/test/test_gzip.py | |
parent | 9da28f311531371bee5a5562190594e7b83cf9aa (diff) | |
download | cpython-863f02a6442a270877e94eb8980c80692b779ed1.tar.gz |
Issue #13781: Fix GzipFile to work with os.fdopen()'d file objects.
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r-- | Lib/test/test_gzip.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index 2b0ac36c23..5ae7467e66 100644 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -323,6 +323,14 @@ class TestGzip(unittest.TestCase): self.assertEqual(f.read(100), b'') self.assertEqual(nread, len(uncompressed)) + def test_fileobj_from_fdopen(self): + # Issue #13781: Opening a GzipFile for writing fails when using a + # fileobj created with os.fdopen(). + fd = os.open(self.filename, os.O_WRONLY | os.O_CREAT) + with os.fdopen(fd, "wb") as f: + with gzip.GzipFile(fileobj=f, mode="w") as g: + pass + # Testing compress/decompress shortcut functions def test_compress(self): |