summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.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/tarfile.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/tarfile.py')
-rwxr-xr-xLib/tarfile.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 78bb10c..5fc6183 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -636,6 +636,10 @@ class _FileInFile(object):
def flush(self):
pass
+ @property
+ def mode(self):
+ return 'rb'
+
def readable(self):
return True