Martin Panter added the comment: I ran into a related issue with the gettarinfo() method. Would that fall under the scope of this bug, or should I raise a separate one?
>>> with tarfile.open("/dev/null", "w") as tar: ... with open(b"/bin/sh", "rb") as file: ... tar.gettarinfo(fileobj=file) ... Traceback (most recent call last): File "<stdin>", line 3, in <module> File "/usr/lib/python3.4/tarfile.py", line 1768, in gettarinfo arcname = arcname.replace(os.sep, "/") TypeError: expected bytes, bytearray or buffer compatible object I realise that making TarInfo object with a byte string or integer as a file name is not a good idea. Perhaps the documentation should explicitly say that “fileobj.name” must be a real unencoded file name string unless “arcname” is also given. In my particular case I added arcname="", because my code generates the proper file name later on. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21044> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com