Bug description:
https://gist.github.com/devdanzin/f8af359770ff200eac8474de5644be82
tarfile.TarFile.next() currently reraises non-zlib exceptions with raise e
inside its generic exception handler:
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
Using raise e adds an extra traceback frame at the re-raise site. A bare
raise would keep the traceback cleaner while preserving the original exception
and its traceback.
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
Windows
Linked PRs
Bug description:
https://gist.github.com/devdanzin/f8af359770ff200eac8474de5644be82
tarfile.TarFile.next()currently reraises non-zlib exceptions withraise einside its generic exception handler:
Using
raise eadds an extra traceback frame at the re-raise site. A bareraisewould keep the traceback cleaner while preserving the original exceptionand its traceback.
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
Windows
Linked PRs
TarFile.next()to reraises non-zlib exceptions with a bareraiseinstead ofraise e. #149761