mirror of
https://github.com/python/cpython.git
synced 2025-08-29 05:05:03 +00:00
Make this work on Mac as well (where Type and Creator are bytes instead of str).
This commit is contained in:
parent
92bab812f7
commit
1b261dff3e
1 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue