Bugs item #1488634, was opened at 2006-05-15 08:25 Message generated for change (Comment added) made by gustaebel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488634&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Andrew Bennetts (spiv) Assigned to: Nobody/Anonymous (nobody) Summary: tarfile.TarFile.open can might incorrectly raise ValueError Initial Comment: 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. ---------------------------------------------------------------------- Comment By: Lars Gustäbel (gustaebel) Date: 2006-05-15 16:19 Message: Logged In: YES user_id=642936 I just submitted patch #1488881 that would solve your problem as a side-effect. Thanks for your report. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488634&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com