summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorbalmeida-nokia <83089745+balmeida-nokia@users.noreply.github.com>2023-08-21 11:39:06 (GMT)
committerGitHub <noreply@github.com>2023-08-21 11:39:06 (GMT)
commit37135d25e269ede92bc7da363bebfa574782e59a (patch)
treec95cf1b525e57084ae62573c4a2e3354d7cf449e /Lib/tarfile.py
parent80bdebdd8593f007a2232ec04a7729bba6ebf12c (diff)
downloadcpython-37135d25e269ede92bc7da363bebfa574782e59a.zip
cpython-37135d25e269ede92bc7da363bebfa574782e59a.tar.gz
cpython-37135d25e269ede92bc7da363bebfa574782e59a.tar.bz2
gh-107396: tarfiles: set self.exception before _init_read_gz() (GH-107485)
In the stack call of: _init_read_gz() ``` _read, tarfile.py:548 read, tarfile.py:526 _init_read_gz, tarfile.py:491 ``` a try;except exists that uses `self.exception`, so it needs to be set before calling _init_read_gz().
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-xLib/tarfile.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 1147d59..a835d00 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -372,8 +372,8 @@ class _Stream:
self.zlib = zlib
self.crc = zlib.crc32(b"")
if mode == "r":
- self._init_read_gz()
self.exception = zlib.error
+ self._init_read_gz()
else:
self._init_write_gz(compresslevel)