Éric Araujo <mer...@netwok.org> added the comment:

I intend to commit this simple fix for all branches:

-    _UNPACK_FORMATS['bztar'] = (['.bz2'], _unpack_tarfile, [],
+    _UNPACK_FORMATS['bztar'] = (['.tar.bz2'], _unpack_tarfile, [],

I could write a unit test, but it would be coupled to the exact text of the 
exception* (i.e. with assertRaisesRegex) and IMO not very useful.  I tested 
manually: I compressed a text file with bzip2, passed the filename to 
unpack_archive, and it tried to unpack it with tarfile.  With my fix, it does 
not try to unpack it.


* unpack_archive raises ValueError when you give an unsupported value to its 
format
  parameter, but when it’s in autodetect mode and can’t find an unpacker for 
the file
  extension, then it raises a ReadError.  Is it okay to change that to 
ValueError?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14061>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to