bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)

Always specify the mode argument for writing.
This commit is contained in:
Serhiy Storchaka 2019-11-16 18:56:57 +02:00 committed by GitHub
parent bd44a7ead9
commit a0652328a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 2 deletions

View file

@ -469,7 +469,9 @@ class TestGzip(BaseTest):
if "x" in mode:
support.unlink(self.filename)
with open(self.filename, mode) as f:
with gzip.GzipFile(fileobj=f) as g:
with self.assertWarns(FutureWarning):
g = gzip.GzipFile(fileobj=f)
with g:
self.assertEqual(g.mode, gzip.WRITE)
def test_bytes_filename(self):