cpython: 220c70519958 (original) (raw)

Mercurial > cpython

changeset 104834:220c70519958

Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar file with compression before trying to open it without compression. Otherwise it had 50% chance failed with ignore_zeros=True. [#28449]

Serhiy Storchaka storchaka@gmail.com
date Sun, 30 Oct 2016 20:58:31 +0200
parents 6e8183abcc35(current diff)de8e83262644(diff)
children 11cb97de3edd
files Misc/NEWS
diffstat 3 files changed, 14 insertions(+), 2 deletions(-)[+] [-] Lib/tarfile.py 4 Lib/test/test_tarfile.py 8 Misc/NEWS 4

line wrap: on

line diff

--- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1554,7 +1554,9 @@ class TarFile(object): if mode in ("r", "r:*"): # Find out which *open() is appropriate for opening the file.

--- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -3,6 +3,7 @@ import os import io from hashlib import md5 from contextlib import contextmanager +from random import Random import unittest import unittest.mock @@ -349,12 +350,17 @@ class CommonReadTest(ReadTest): def test_ignore_zeros(self): # Test TarFile's ignore_zeros option.

tar = tarfile.open(tmpname, mode="r", ignore_zeros=True) try:

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -99,6 +99,10 @@ Core and Builtins Library ------- +- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar