Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change error message for IndexError for increased clarity #488

Closed
ECP5-PCIe opened this issue Aug 25, 2020 · 0 comments
Closed

Change error message for IndexError for increased clarity #488

ECP5-PCIe opened this issue Aug 25, 2020 · 0 comments
Milestone

Comments

@ECP5-PCIe
Copy link

@ECP5-PCIe ECP5-PCIe commented Aug 25, 2020

If you for example have a signal x = Signal(16) and try to address a bit which is out of bounds, for example x[16] you get an IndexError: Cannot index 16 bits into 16-bit value.
This is somewhat unclear, since 16 bits sounds like it refers to bit number 16, which this signal has. But in reality it refers to the addressed index.
I suggest renaming it to something like IndexError: Index 16 is out of bounds for a Signal of length 16 such that it is clear that 16 refers to an index (which start at 0) and not to a bit.

@whitequark whitequark added this to the 0.3 milestone Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants