summaryrefslogtreecommitdiff
path: root/Lib/binhex.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-28 03:35:35 +0000
committerGuido van Rossum <guido@python.org>2007-08-28 03:35:35 +0000
commit1b261dff3e24cbe063bed2e09f2f80061293004f (patch)
treeea60a0c0678bb96b9ba5f6dd8a6c135976941b80 /Lib/binhex.py
parent92bab812f7e9b7a27054cfa302223c3f583bff9c (diff)
downloadcpython-git-1b261dff3e24cbe063bed2e09f2f80061293004f.tar.gz
Make this work on Mac as well (where Type and Creator are bytes instead of str).
Diffstat (limited to 'Lib/binhex.py')
-rw-r--r--Lib/binhex.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/binhex.py b/Lib/binhex.py
index 0dfa475f44..a56a8c85b1 100644
--- a/Lib/binhex.py
+++ b/Lib/binhex.py
@@ -192,7 +192,12 @@ class BinHex:
if nl > 63:
raise Error, 'Filename too long'
d = bytes([nl]) + name.encode("latin-1") + b'\0'
- d2 = bytes(finfo.Type, "ascii") + bytes(finfo.Creator, "ascii")
+ tp, cr = finfo.Type, finfo.Creator
+ if isinstance(tp, str):
+ tp = tp.encode("latin-1")
+ if isinstance(cr, str):
+ cr = cr.encode("latin-1")
+ d2 = tp + cr
# Force all structs to be packed with big-endian
d3 = struct.pack('>h', finfo.Flags)