summaryrefslogtreecommitdiffstats
path: root/Lib/binhex.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/binhex.py')
-rw-r--r--Lib/binhex.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/binhex.py b/Lib/binhex.py
index 16985fb..4f3882a 100644
--- a/Lib/binhex.py
+++ b/Lib/binhex.py
@@ -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):