-
Notifications
You must be signed in to change notification settings - Fork 822
Fix Python failure handling in Pythonwin/pywin/framework/scriptutils.py
#2319
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
base: main
Are you sure you want to change the base?
Conversation
else: | ||
traceback.print_exc() | ||
win32ui.SetStatusText("Failed to " + what + " - " + str(details)) | ||
win32ui.SetStatusText(f"Failed to {what} - {type(details)} - {details}") |
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.
Deduplicated win32ui.SetStatusText
.
I have also considered the following:
win32ui.SetStatusText(f"Failed to {what} - {type(details)} - {details}") | |
win32ui.SetStatusText(f"Failed to {what} - {details!r}") |
else: | ||
traceback.print_exc() | ||
win32ui.SetStatusText("Failed to " + what + " - " + str(details)) | ||
win32ui.SetStatusText(f"Failed to {what} - {type(details)} - {details}") | ||
tb = None # Clean up a cycle. |
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.
What does this tb = None
do exactly?
c851363
to
d285d40
Compare
…tutils-handle-failure
…tutils-handle-failure
try: | ||
msg, (fileName, line, col, text) = details |
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 code would produce:
TypeError: cannot unpack non-iterable SyntaxError object
and improve error message
The previous code would produce a
TypeError: cannot unpack non-iterable SyntaxError object
onSyntaxError