]> granicus.if.org Git - python/commit
bpo-34588: Fix an off-by-one error in traceback formatting. (GH-9077)
authorBenjamin Peterson <benjamin@python.org>
Mon, 10 Sep 2018 15:43:10 +0000 (08:43 -0700)
committerGitHub <noreply@github.com>
Mon, 10 Sep 2018 15:43:10 +0000 (08:43 -0700)
commitd545869d084e70d4838310e79b52a25a72a1ca56
tree56b624b6b77b7db4a8f12952480e0224e228c72c
parent54752533b2ed1c898ffe5ec2e795c6910ee46a39
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.
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