gh-132385: Fix instance error suggestions potential exceptions in traceback#132387
Merged
sobolevn merged 2 commits intopython:mainfrom May 2, 2025
Merged
gh-132385: Fix instance error suggestions potential exceptions in traceback#132387sobolevn merged 2 commits intopython:mainfrom
traceback#132387sobolevn merged 2 commits intopython:mainfrom
Conversation
iritkatriel
reviewed
Apr 11, 2025
Lib/traceback.py
Outdated
| if hasattr(self, wrong_name): | ||
| try: | ||
| has_wrong_name = hasattr(self, wrong_name) | ||
| except BaseException: |
Member
There was a problem hiding this comment.
This can swallow things like KeyboardInterrupt and MemoryError. We shouldn't do that.
Member
Author
There was a problem hiding this comment.
No :)
>>> SystemExit.__mro__
(<class 'SystemExit'>, <class 'BaseException'>, <class 'object'>)
Member
Author
|
After this change: 2025-04-11.13.45.38.mov |
iritkatriel
reviewed
May 1, 2025
iritkatriel
approved these changes
May 2, 2025
Member
Author
|
@iritkatriel thank you! |
|
Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
May 2, 2025
…eptions in `traceback` (pythonGH-132387) (cherry picked from commit 641253c) Co-authored-by: sobolevn <mail@sobolevn.me>
|
GH-133297 is a backport of this pull request to the 3.13 branch. |
Pranjal095
pushed a commit
to Pranjal095/cpython
that referenced
this pull request
Jul 12, 2025
…eptions in `traceback` (python#132387)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It does not cover all side-effects, it will still evaluate
print, etc.But, it does not fail with exceptions at least.
__getattr__#132385