-
Notifications
You must be signed in to change notification settings - Fork 11
Check args more thoroghly in sense_hat.py and mangle traceback for sense_hat.py errors
#1348
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1b0b5ea
Specifically mangle traceback for `sense_hat.py` errors
patch0 3d206a4
Fix pixel length checks in set_pixels too
patch0 d55dea3
Add safe navigation for the traceback
patch0 164ee52
Add safety to the check; add tests
patch0 bb5895d
Lint
patch0 6df6926
Add a big comment
patch0 fc02afa
Don't mutate the traceback array
patch0 1d20deb
Tune error handling
patch0 5e8a655
Reduce noise in error messages
patch0 7579ab0
Apply suggestion from @Copilot
patch0 22066bf
Update package version
patch0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The traceback mangling triggers for any exception whose top frame filename is "./sense_hat.py", even if the user has created their own local
sense_hat.pyfile. SincebuiltinReadprefers local project files over external libraries, this can incorrectly attribute real user-code errors insense_hat.pytomain.py. Consider guarding this logic by checking whether asense_hat.pycomponent exists in the current project (and skipping mangling if it does), or otherwise positively identifying the external shim source before rewriting the traceback frame.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea, but I think it is vanishingly small that someone would write a sense_hat.py file. It would make testing much more complex, as we'd have to stub the
fetch(), which is tricky.