From b3f515af646abf590f57fc6fe0da9eedfbbbb367 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 24 Jan 1997 04:02:55 +0000 Subject: Get the line number from PyCode_Addr2Line instead of believing tb_lineno. Store it in tb_lineno for the user. --- Python/traceback.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/traceback.c b/Python/traceback.c index b06a742..3f80ef5 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -243,11 +243,14 @@ tb_printinternal(tb, f, limit) tb1 = tb1->tb_next; } while (tb != NULL && !intrcheck()) { - if (depth <= limit) + if (depth <= limit) { + tb->tb_lineno = PyCode_Addr2Line(tb->tb_frame->f_code, + tb->tb_lasti); tb_displayline(f, getstringvalue(tb->tb_frame->f_code->co_filename), tb->tb_lineno, getstringvalue(tb->tb_frame->f_code->co_name)); + } depth--; tb = tb->tb_next; } -- cgit v0.12