-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
bpo-42848: remove recursion from TracebackException #24158
Conversation
d954d86
to
6ddce07
Compare
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.
Awesome! Here are some suggestions.
Lib/traceback.py
Outdated
@@ -481,39 +481,10 @@ def __init__(self, exc_type, exc_value, exc_traceback, *, limit=None, | |||
# permit backwards compat with the existing API, otherwise we | |||
# need stub thunk objects just to glue it together. | |||
# Handle loops in __cause__ or __context__. | |||
_is_chained = _seen is not None |
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 doesn't need to have a _
prefix, it's just a local variable.
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.
Yes. Before I realized I can use _seen this was another private arg, so had the _. I'll change to is_recursive_call so it's clear what it's for.
Lib/traceback.py
Outdated
yield from self.stack.format() | ||
yield from self.format_exception_only() | ||
|
||
stack = [] |
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.
It's a bit confusing that we have a local variable stack
now but also an attribute exc.stack
(completely unrelated).
Lib/traceback.py
Outdated
while stack: | ||
msg, exc = stack.pop() |
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.
A faster way might be to use for msg, exc in reversed(stack):
(this may also give you inspiration for what to name the variable. :-)
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.
LGTM. Now it just needs a news entry. And why is the Ubuntu test failing?
The test failure doesn't look related, it's a tkinter widget test:
|
Blurbit bot is not working today. Who fixes that? |
But did you know you can just run the blurb tool locally? https://pypi.org/project/blurb/ |
But possibly a merge from latest master might help (IIRC Serhiy has been working on tkinter recently). |
Thanks for raising the issue with blurb-it to my attention. This should be fixed now, please try it again. |
… rather than a tree
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
be85edc
to
f1591cb
Compare
Yes, all the bots are happy now. Thanks @gvanrossum and @Mariatta. |
Thanks Irit! |
https://bugs.python.org/issue42848