tarfile.TarFile.open, if passed a fileobj argument for
a valid plain tar or tar.gz file, might fail to open
the file, and instead unexpectedly raise "ValueError:
no support for external file objects".
"open" iterates over TarFile.OPEN_METH, which is a
dictionary, to try find a method that works for a given
file. If the internal, undefined, ordering of that
dict returns the "bz2" key before the right one for a
given file, and the fileobj argument is passed, TarFile
will attempt to call bz2open with the fileobj method,
which then raises "ValueError: no support for external
file objects", which then is not caught.
The end result is that it's possible to pass a valid
tar or tar.gz file to TarFile.open in the fileobj
argument, but get a ValueError from bz2open instead of
a TarFile object.
|