Get the line number from PyCode_Addr2Line instead of believing

tb_lineno.  Store it in tb_lineno for the user.
This commit is contained in:
Guido van Rossum 1997-01-24 04:02:55 +00:00
parent 747596a491
commit b3f515af64
1 changed files with 4 additions and 1 deletions

View File

@ -243,11 +243,14 @@ tb_printinternal(tb, f, limit)
tb1 = tb1->tb_next; tb1 = tb1->tb_next;
} }
while (tb != NULL && !intrcheck()) { 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, tb_displayline(f,
getstringvalue(tb->tb_frame->f_code->co_filename), getstringvalue(tb->tb_frame->f_code->co_filename),
tb->tb_lineno, tb->tb_lineno,
getstringvalue(tb->tb_frame->f_code->co_name)); getstringvalue(tb->tb_frame->f_code->co_name));
}
depth--; depth--;
tb = tb->tb_next; tb = tb->tb_next;
} }