]> granicus.if.org Git - python/commit
bpo-34588: Fix an off-by-one error in traceback formatting. benjamin-traceback-obo
authorBenjamin Peterson <benjamin@python.org>
Thu, 6 Sep 2018 05:57:02 +0000 (22:57 -0700)
committerBenjamin Peterson <benjamin@python.org>
Thu, 6 Sep 2018 05:57:02 +0000 (22:57 -0700)
commit02bf1849e85d0715de30e1d0ecd759532b1c11b5
tree25a4485c7d20e5ed99957d003380a1b54bdfd3a2
parent874809ea389e6434787e773a6054a08e0b81f734
bpo-34588: Fix an off-by-one error in traceback formatting.

The recursive frame pruning code always undercounted the number of elided frames
by one. That is, in the "[Previous line repeated N more times]" message, N would
always be one too few. Near the recursive pruning cutoff, one frame could be
silently dropped. That situation is demonstrated in the OP of the bug report.

The fix is to start the identical frame counter at 1.
Lib/test/test_traceback.py
Lib/traceback.py
Misc/NEWS.d/next/Core and Builtins/2018-09-05-22-56-52.bpo-34588.UIuPmL.rst [new file with mode: 0644]
Python/traceback.c