Skip to content

Commit

Permalink
Do not format host messages
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Savkin <es@m-labs.hk>
  • Loading branch information
thomasfire committed Mar 9, 2023
1 parent a936082 commit 11c6ebc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions artiq/coredevice/comm_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,21 +642,21 @@ def read_exception_string():
# note: if length == -1, the following int32 is the object key
length = self._read_int32()
if length == -1:
return embedding_map.retrieve_str(self._read_int32())
return False, embedding_map.retrieve_str(self._read_int32())
else:
return self._read(length).decode("utf-8")
return True, self._read(length).decode("utf-8")

for _ in range(exception_count):
name = embedding_map.retrieve_str(self._read_int32())
message = read_exception_string()
use_fmt, message = read_exception_string()
params = [self._read_int64() for _ in range(3)]

filename = read_exception_string()
_, filename = read_exception_string()
line = self._read_int32()
column = self._read_int32()
function = read_exception_string()
_, function = read_exception_string()
nested_exceptions.append([name, message, params,
filename, line, column, function])
filename, line, column, function, use_fmt])

demangled_names = demangler([ex[6] for ex in nested_exceptions])
for i in range(exception_count):
Expand Down Expand Up @@ -688,7 +688,7 @@ def read_exception_string():

try:
python_exn = python_exn_type(
nested_exceptions[-1][1].format(*nested_exceptions[0][2]))
nested_exceptions[-1][1].format(*nested_exceptions[0][2]) if nested_exceptions[-1][7] else nested_exceptions[-1][1])
except Exception as ex:
python_exn = RuntimeError(
f"Exception type={python_exn_type}, which couldn't be "
Expand Down
2 changes: 1 addition & 1 deletion artiq/coredevice/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def single_traceback(self, exception_index):
exn_id = int(exn_id)
else:
exn_id = 0
lines.append("{}({}): {}".format(name, exn_id, message.format(*params)))
lines.append("{}({}): {}".format(name, exn_id, message.format(*params) if exception[7] else message))
zipped.append(((exception[3], exception[4], exception[5], exception[6],
None, []), None))

Expand Down

0 comments on commit 11c6ebc

Please sign in to comment.