]> granicus.if.org Git - python/commitdiff
Get the line number from PyCode_Addr2Line instead of believing
authorGuido van Rossum <guido@python.org>
Fri, 24 Jan 1997 04:02:55 +0000 (04:02 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 24 Jan 1997 04:02:55 +0000 (04:02 +0000)
tb_lineno.  Store it in tb_lineno for the user.

Python/traceback.c

index b06a74286b6903a84f6d54eb8c9c93ced3c70187..3f80ef5e56c882f2d4d7c7500360fccc578a84b3 100644 (file)
@@ -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;
        }