diff -r 89e7cfa618a5 Lib/tarfile.py --- a/Lib/tarfile.py Fri Dec 07 07:07:56 2012 +0300 +++ b/Lib/tarfile.py Fri Dec 07 07:42:04 2012 +0300 @@ -29,7 +29,7 @@ """Read from and write to tar format archives. """ -version = "0.9.0" +version = "0.9.1" __author__ = "Lars Gust\u00e4bel (lars@gustaebel.de)" __date__ = "$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $" __cvsid__ = "$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $" @@ -1974,7 +1974,7 @@ directories = [] if members is None: - members = self + members = self.getmembers() for tarinfo in members: if tarinfo.isdir(): diff -r 89e7cfa618a5 Lib/test/test_tarfile.py --- a/Lib/test/test_tarfile.py Fri Dec 07 07:07:56 2012 +0300 +++ b/Lib/test/test_tarfile.py Fri Dec 07 07:42:04 2012 +0300 @@ -362,7 +362,23 @@ finally: tar.close() - def test_extractall(self): + def test_extractall_after_next(self): + # Test extractall() unpacks all files after calling .next() + # (see issue #16631) + tar = tarfile.open(tarname, encoding="iso8859-1") + filename = tar.next().name + DIR = os.path.join(TEMPDIR, "extractall") + fullname = os.path.join(DIR, filename) + os.mkdir(DIR) + try: + tar.extractall(DIR) + if not os.path.exists(fullname): + self.fail("extractall filed to unpack all files") + finally: + tar.close() + shutil.rmtree(DIR) + + def test_extractall_dir_attributes(self): # Test if extractall() correctly restores directory permissions # and times (see issue1735). tar = tarfile.open(tarname, encoding="iso8859-1")