Message216984
| Author |
martin.panter |
| Recipients |
antoine.pietri, eric.araujo, eryksun, lars.gustaebel, martin.panter, r.david.murray, serhiy.storchaka |
| Date |
2014年04月22日.04:34:31 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1398141271.58.0.566913183651.issue21044@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|