summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-04-21 08:46:39 (GMT)
committerGitHub <noreply@github.com>2024-04-21 08:46:39 (GMT)
commit51ef89cd9acbfbfa7fd8d82f0c6baa388bb650c9 (patch)
treeeb6f52baa37360fb86c7401d12c47f51ad3795af /Lib/gzip.py
parentccda73828473576c57d1bb31774f56542d6e8964 (diff)
downloadcpython-51ef89cd9acbfbfa7fd8d82f0c6baa388bb650c9.zip
cpython-51ef89cd9acbfbfa7fd8d82f0c6baa388bb650c9.tar.gz
cpython-51ef89cd9acbfbfa7fd8d82f0c6baa388bb650c9.tar.bz2
gh-115961: Add name and mode attributes for compressed file-like objects (GH-116036)
* Add name and mode attributes for compressed and archived file-like objects in modules bz2, lzma, tarfile and zipfile. * Change the value of the mode attribute of GzipFile from integer (1 or 2) to string ('rb' or 'wb'). * Change the value of the mode attribute of ZipExtFile from 'r' to 'rb'.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 1d6faaa..0d19c84 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -15,7 +15,8 @@ __all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"]
FTEXT, FHCRC, FEXTRA, FNAME, FCOMMENT = 1, 2, 4, 8, 16
-READ, WRITE = 1, 2
+READ = 'rb'
+WRITE = 'wb'
_COMPRESS_LEVEL_FAST = 1
_COMPRESS_LEVEL_TRADEOFF = 6