Issue 34588: traceback formatting can drop a frame (original) (raw)
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/78769
classification
Title: | traceback formatting can drop a frame | ||
---|---|---|---|
Type: | behavior | Stage: | resolved |
Components: | Interpreter Core, Library (Lib) | Versions: | Python 3.8, Python 3.7, Python 3.6 |
process
Status: | closed | Resolution: | fixed |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | benjamin.peterson, miss-islington, serhiy.storchaka | |
Priority: | normal | Keywords: | patch |
Created on 2018-09-05 17:52 by benjamin.peterson, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 9077 | merged | benjamin.peterson,2018-09-06 06:03 | |
PR 9134 | merged | miss-islington,2018-09-10 15:43 | |
PR 9135 | merged | miss-islington,2018-09-10 15:43 |
Messages (7) | ||
---|---|---|
msg324648 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2018-09-05 17:52 |
Consider the following script: import traceback 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. | ||
msg324663 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2018-09-06 05:54 |
Further investigation reveals this is a general off-by-one error with the recursive traceback pruning feature. | ||
msg324827 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-09-08 10:17 |
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. | ||
msg324858 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2018-09-08 19:01 |
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. | ||
msg324926 - (view) | Author: Benjamin Peterson (benjamin.peterson) * ![]() |
Date: 2018-09-10 15:43 |
New changeset d545869d084e70d4838310e79b52a25a72a1ca56 by Benjamin Peterson in branch 'master': bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077) https://github.com/python/cpython/commit/d545869d084e70d4838310e79b52a25a72a1ca56 | ||
msg324928 - (view) | Author: miss-islington (miss-islington) | Date: 2018-09-10 16:00 |
New changeset 49020174305ca3dc90a811b03a05f44873297c61 by Miss Islington (bot) in branch '3.7': bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077) https://github.com/python/cpython/commit/49020174305ca3dc90a811b03a05f44873297c61 | ||
msg324931 - (view) | Author: miss-islington (miss-islington) | Date: 2018-09-10 16:10 |
New changeset afb25bc2b5767ac3a83bc8c4d2826e8fdcb6b0e7 by Miss Islington (bot) in branch '3.6': bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077) https://github.com/python/cpython/commit/afb25bc2b5767ac3a83bc8c4d2826e8fdcb6b0e7 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:05 | admin | set | github: 78769 |
2018-09-10 16:10:25 | miss-islington | set | nosy: + miss-islingtonmessages: + |
2018-09-10 16:01:12 | benjamin.peterson | set | status: open -> closednosy: - miss-islingtonresolution: fixedstage: patch review -> resolved |
2018-09-10 16:00:13 | miss-islington | set | nosy: + miss-islingtonmessages: + |
2018-09-10 15:43:35 | miss-islington | set | pull_requests: + <pull%5Frequest8588> |
2018-09-10 15:43:27 | miss-islington | set | pull_requests: + <pull%5Frequest8587> |
2018-09-10 15:43:17 | benjamin.peterson | set | messages: + |
2018-09-08 19:01:30 | benjamin.peterson | set | messages: + |
2018-09-08 10:17:54 | serhiy.storchaka | set | nosy: + serhiy.storchakamessages: + |
2018-09-06 06:03:02 | benjamin.peterson | set | keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest8535> |
2018-09-06 05:54:34 | benjamin.peterson | set | messages: + components: + Interpreter Coretitle: traceback module can drop a frame -> traceback formatting can drop a frame |
2018-09-05 17:52:12 | benjamin.peterson | create |