[issue11513] Infinite recursion around raising an exception in tarfile

R. David Murray report at bugs.python.org
Wed Mar 16 17:40:57 CET 2011

R. David Murray <rdmurray at bitdance.com> added the comment:

This fix reveals a second bug.  Without this fix, a non-existent file raises an IOError with an appropriate error message, but with the chained exception.  After this fix, it raises an error that says 'not a gzip file', which while technically true is not very helpful :)

The correct IOError message only happened by accident in the original code, but we need to fix this second bug in order to fix the first one correctly.  I suggest that the test case should read:

  with self.assertRaisesRegex("xxx", IOError) as ex:
      tarfile.open("xxx", self.mode)
  self.assertEqual(ex.exception.errno, errno.ENOENT)

nosy: +r.david.murray

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list