diff options
| author | Lars Gustäbel <lars@gustaebel.de> | 2011-12-21 18:27:50 (GMT) |
|---|---|---|
| committer | Lars Gustäbel <lars@gustaebel.de> | 2011-12-21 18:27:50 (GMT) |
| commit | 7d4d074c9996f07a859a6e5a38774aa65a4ff85c (patch) | |
| tree | 0b687fb4e67971b42df43b78a3bc78ae1701a065 /Lib/test | |
| parent | 5b95eb90a7167285b6544b50865227c584943c9a (diff) | |
| download | cpython-7d4d074c9996f07a859a6e5a38774aa65a4ff85c.zip cpython-7d4d074c9996f07a859a6e5a38774aa65a4ff85c.tar.gz cpython-7d4d074c9996f07a859a6e5a38774aa65a4ff85c.tar.bz2 | |
Issue #13639: Accept unicode filenames in tarfile.open(mode="w|gz").
Passing a unicode filename to tarfile.open() along with mode "w|gz" failed
with a UnicodeError because the filename was not encoded properly before being
written to the gzipped stream in the FNAME extra field.
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_tarfile.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 49d2d07..d5b864e 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -994,6 +994,13 @@ class StreamWriteTest(WriteTestBase): finally: os.umask(original_umask) + def test_issue13639(self): + try: + with tarfile.open(unicode(tmpname, sys.getfilesystemencoding()), self.mode): + pass + except UnicodeDecodeError: + self.fail("_Stream failed to write unicode filename") + class GNUWriteTest(unittest.TestCase): # This testcase checks for correct creation of GNU Longname |
