]> granicus.if.org Git - python/commitdiff
quick hack to fix busted binhex test
authorBob Ippolito <bob@redivi.com>
Fri, 26 May 2006 12:52:53 +0000 (12:52 +0000)
committerBob Ippolito <bob@redivi.com>
Fri, 26 May 2006 12:52:53 +0000 (12:52 +0000)
Lib/binhex.py

index 16985fb16694c47e156a080354d518be9a0cba9b..4f3882ac06718165a39a8f4a3ad26dc85a3b3dff 100644 (file)
@@ -217,7 +217,11 @@ class BinHex:
     def _writecrc(self):
         # XXXX Should this be here??
         # self.crc = binascii.crc_hqx('\0\0', self.crc)
-        self.ofp.write(struct.pack('>h', self.crc))
+        if self.crc < 0:
+            fmt = '>h'
+        else:
+            fmt = '>H'
+        self.ofp.write(struct.pack(fmt, self.crc))
         self.crc = 0
 
     def write(self, data):