-
-
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
traceback formatting can drop a frame #78769
Comments
Consider the following script: def fill_stack(depth):
if depth <= 1:
return traceback.format_stack()
else:
return fill_stack(depth - 1) assert fill_stack(4) != fill_stack(5) On the Python 3 versions I tested, this script doesn't fail! Somehow traceback is producing identical tracebacks for different callstacks. |
Further investigation reveals this is a general off-by-one error with the recursive traceback pruning feature. |
In case of 4 repeated lines it doesn't make much sense to output 3 repeated lines and replace the forth line with "Previous line repeated 1 more time". This doesn't save space and doesn't help reading the traceback. I think it is better to output the forth repeated line. |
It actually does save space because each traceback entry is usually two lines (frame id and source snippet). I don't really have an opinion about what should happen be printed on the boundary cases. My current PR seems like a strict improvement to the current implementation, which is just incorrect. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: