diff options
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 18d415a..c1ee122 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2349,6 +2349,15 @@ class TarFile(object): raise ReadError(str(e)) from None except SubsequentHeaderError as e: raise ReadError(str(e)) from None + except Exception as e: + try: + import zlib + if isinstance(e, zlib.error): + raise ReadError(f'zlib error: {e}') from None + else: + raise e + except ImportError: + raise e break if tarinfo is not None: |