diff --git a/artiq/coredevice/comm_generic.py b/artiq/coredevice/comm_generic.py index b67b8acec..b4059fdcc 100644 --- a/artiq/coredevice/comm_generic.py +++ b/artiq/coredevice/comm_generic.py @@ -457,8 +457,8 @@ class CommGeneric: self._write_header(_H2DMsgType.RPC_EXCEPTION) - if hasattr(exn, 'core_exception'): - exn = exn.core_exception + if hasattr(exn, 'artiq_core_exception'): + exn = exn.artiq_core_exception self._write_string(exn.name) self._write_string(exn.message) for index in range(3): @@ -504,15 +504,15 @@ class CommGeneric: traceback = list(reversed(symbolizer(backtrace))) + \ [(filename, line, column, function, None)] - core_exception = exceptions.CoreException(name, message, params, traceback) + core_exn = exceptions.CoreException(name, message, params, traceback) - if core_exception.id == 0: - python_exn_type = getattr(exceptions, core_exception.name.split('.')[-1]) + if core_exn.id == 0: + python_exn_type = getattr(exceptions, core_exn.name.split('.')[-1]) else: - python_exn_type = object_map.retrieve(core_exception.id) + python_exn_type = object_map.retrieve(core_exn.id) python_exn = python_exn_type(message.format(*params)) - python_exn.core_exception = core_exception + python_exn.artiq_core_exception = core_exn raise python_exn def serve(self, object_map, symbolizer): diff --git a/artiq/coredevice/exceptions.py b/artiq/coredevice/exceptions.py index ea74f7a61..0576b2610 100644 --- a/artiq/coredevice/exceptions.py +++ b/artiq/coredevice/exceptions.py @@ -1,4 +1,8 @@ import builtins +import linecache +import re +import os + from artiq.coredevice.runtime import source_loader diff --git a/artiq/frontend/artiq_run.py b/artiq/frontend/artiq_run.py index f1697632f..5a37e0707 100755 --- a/artiq/frontend/artiq_run.py +++ b/artiq/frontend/artiq_run.py @@ -132,8 +132,8 @@ def run(with_file=False): except CompileError as error: return except Exception as exn: - if hasattr(exn, 'core_exception'): - print(exn.core_exception, file=sys.stderr) + if hasattr(exn, 'artiq_core_exception'): + print(exn.artiq_core_exception, file=sys.stderr) raise exn finally: device_mgr.close_devices() diff --git a/artiq/language/core.py b/artiq/language/core.py index 648f0dddd..7d6728f61 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -2,7 +2,6 @@ Core ARTIQ extensions to the Python language. """ -import os, linecache, re from collections import namedtuple from functools import wraps