]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 10 Sep 2018 16:10:21 +0000 (09:10 -0700)
committerGitHub <noreply@github.com>
Mon, 10 Sep 2018 16:10:21 +0000 (09:10 -0700)
commitafb25bc2b5767ac3a83bc8c4d2826e8fdcb6b0e7
treee6b2f1ab399fa1e70a5f088de2d9029c77b747b0
parent9f5351edbe8610f75174013be66a767fecf78fe2
bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)

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.
(cherry picked from commit d545869d084e70d4838310e79b52a25a72a1ca56)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
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