-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
py3: use format_exc instead of print_exception #3078
Conversation
@MrOutis you left things like |
dvc/logger.py
Outdated
exc = exc_info[1] | ||
tb = buffer.getvalue() | ||
tb = traceback.format_exc(*exc_info) |
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.
Note that we no longer need cause_tb
down below, so tb_list
will only contain one entry, so we should get rid of it.
|
||
# NOTE: parsing chained exceptions. See dvc/exceptions.py for more info | ||
while hasattr(exc, "__cause__") and exc.__cause__: |
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.
Again, what about __context__
?
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.
@Suor , __context__
? We are not using __context__
, and that should be the matter of another PR, I guess 😕
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.
Python 3 automatically assigns __context__
when you raise an exception while handling exception. So if you don't use either from exc
or from None
you still can show the original cause, this is usually an error in an error handler, which we probably want to see.
@Suor , implicit errors don't work with the current implementation. |
@MrOutis implicit errors work when you |
@Suor we didn't have |
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.
Thanks!
Related: #1818