-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-132385: Fix instance error suggestions potential exceptions in traceback
#132387
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
Conversation
Lib/traceback.py
Outdated
if hasattr(self, wrong_name): | ||
try: | ||
has_wrong_name = hasattr(self, wrong_name) | ||
except BaseException: |
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 can swallow things like KeyboardInterrupt and MemoryError. We shouldn't do that.
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.
Then Exception
only?
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.
Would that catch SystemExit?
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.
No :)
>>> SystemExit.__mro__
(<class 'SystemExit'>, <class 'BaseException'>, <class 'object'>)
After this change: 2025-04-11.13.45.38.mov |
@iritkatriel thank you! |
Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…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. |
It does not cover all side-effects, it will still evaluate
print
, etc.But, it does not fail with exceptions at least.
__getattr__
#132385