Skip to content

Commit

Permalink
DFReader.py: correct fatal error when stringifying FILE messages
Browse files Browse the repository at this point in the history
These are arbitrary binary data and don't have a single-byte representation we can use in this text output if we want plain-ascii.
  • Loading branch information
peterbarker committed Oct 21, 2022
1 parent 16a51bb commit 189bbe5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion DFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,14 @@ def __str__(self):
noisy_nan = "\x7f\xf8\x00\x00\x00\x00\x00\x00"
if struct.pack(">d", val) != noisy_nan:
val = "qnan"
ret += "%s : %s, " % (c, val)

if is_py3:
ret += "%s : %s, " % (c, val)
else:
try:
ret += "%s : %s, " % (c, val)
except UnicodeDecodeError:
ret += "%s : %s, " % (c, to_string(val))
col_count += 1
if col_count != 0:
ret = ret[:-2]
Expand Down

0 comments on commit 189bbe5

Please sign in to comment.