[issue13639] UnicodeDecodeError when creating tar.gz with unicode name

Lars Gustäbel report at bugs.python.org
Sat Dec 24 12:13:00 CET 2011


Lars Gustäbel <lars at gustaebel.de> added the comment:

I thought about that myself, too. It is clearly no new feature, it is really more some kind of a fix.

Unicode pathnames given to tarfile.open() are just passed through to the open() function, which is why this always has been working, except for this particular case. There are 6 different possible write modes: "w:", "w:gz", "w:bz2", "w|", "w|gz" and "w|bz2". And the only one not working with a unicode pathname is "w|gz". Although admittedly tarfile.open() is not supposed to be used with a unicode path, people do it anyway, because they don't care, and because it works. The patch does not add a new broad functionality, it merely harmonises the way the six write modes work.

Neither can we retroactively enforce using string pathnames at this point, nor should we let a user run into this strange error. The patch is very small and minimally invasive. The error message you get without the patch is completely incomprehensible.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13639>
_______________________________________


More information about the Python-bugs-list mailing list