diff Python/traceback.c @ 5046:658815230546 legacy-trunk

Get the line number from PyCode_Addr2Line instead of believing tb_lineno. Store it in tb_lineno for the user.
author Guido van Rossum <guido@python.org>
date Fri, 24 Jan 1997 04:02:55 +0000
parents 65d2d8e67da3
children c72c7e1930b3
line wrap: on
line diff
--- a/Python/traceback.c	Fri Jan 24 04:00:21 1997 +0000
+++ b/Python/traceback.c	Fri Jan 24 04:02:55 1997 +0000
@@ -243,11 +243,14 @@
 		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;
 	}