Fix throwing non-embedded builtin exceptions #2663
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ARTIQ Pull Request
Description of Changes
comm_kernel
currently encodes all (Python) builtin exceptions with an id of 0. However, lookup for these exceptions happens from theartiq.coredevice.exceptions
module. This means if you try to throw a builtin exception not in the embedding map, then it crashes when receiving it on the host. This also prevents you catching these exceptions in kernel code.We now encode only use an exn id of 0 if the exception is in the exceptions module (and thus already in the embedding map).
I believe this is a relatively recent regression — I noticed this while in the process of updating to latest ARTIQ. This was possibly introduced in #2526, but afraid I have not bisected this.
Type of Changes
Steps (Choose relevant, delete irrelevant before submitting)
All Pull Requests
git commit --signoff
, see copyright).Code Changes
flake8
to check code style (follow PEP-8 style).flake8
has issues with parsing Migen/gateware code, ignore as necessary.