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'.
This commit is contained in:
Serhiy Storchaka 2024-04-21 11:46:39 +03:00 committed by GitHub
parent ccda738284
commit 51ef89cd9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 246 additions and 37 deletions

View file

@ -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