[Python-checkins] r54908 - python/branches/release25-maint/Lib/tarfile.py

lars.gustaebel python-checkins at python.org
Sat Apr 21 14:20:13 CEST 2007


Author: lars.gustaebel
Date: Sat Apr 21 14:20:09 2007
New Revision: 54908

Modified:
   python/branches/release25-maint/Lib/tarfile.py
Log:
Support for unicode strings as input filenames is neither documented
nor intended but works in Python 2.4 under certain conditions. This
stopped working in 2.5 because struct.pack is used. This small patch
restores the old behaviour. A more solid solution is planned for 2.6.


Modified: python/branches/release25-maint/Lib/tarfile.py
==============================================================================
--- python/branches/release25-maint/Lib/tarfile.py	(original)
+++ python/branches/release25-maint/Lib/tarfile.py	Sat Apr 21 14:20:09 2007
@@ -963,7 +963,7 @@
             stn(prefix, 155)
         ]
 
-        buf += struct.pack("%ds" % BLOCKSIZE, "".join(parts))
+        buf += "".join(parts).ljust(BLOCKSIZE, NUL)
         chksum = calc_chksums(buf[-BLOCKSIZE:])[0]
         buf = buf[:-364] + "%06o\0" % chksum + buf[-357:]
         self.buf = buf


More information about the Python-checkins mailing list