|
1 | 1 | /*********************************************************** |
2 | | -Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, |
| 2 | +Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, |
3 | 3 | Amsterdam, The Netherlands. |
4 | 4 |
|
5 | 5 | All Rights Reserved |
@@ -74,9 +74,9 @@ static typeobject Tracebacktype = { |
74 | 74 | "traceback", |
75 | 75 | sizeof(tracebackobject), |
76 | 76 | 0, |
77 | | - tb_dealloc, /*tp_dealloc*/ |
| 77 | + (destructor)tb_dealloc, /*tp_dealloc*/ |
78 | 78 | 0, /*tp_print*/ |
79 | | - tb_getattr, /*tp_getattr*/ |
| 79 | + (getattrfunc)tb_getattr, /*tp_getattr*/ |
80 | 80 | 0, /*tp_setattr*/ |
81 | 81 | 0, /*tp_compare*/ |
82 | 82 | 0, /*tp_repr*/ |
@@ -150,14 +150,22 @@ tb_store(v) |
150 | 150 | } |
151 | 151 |
|
152 | 152 | static void |
153 | | -tb_displayline(f, filename, lineno) |
| 153 | +tb_displayline(f, filename, lineno, name) |
154 | 154 | object *f; |
155 | 155 | char *filename; |
156 | 156 | int lineno; |
| 157 | + char *name; |
157 | 158 | { |
158 | 159 | FILE *xfp; |
159 | 160 | char linebuf[1000]; |
160 | 161 | int i; |
| 162 | +#ifdef MPW |
| 163 | + /* This is needed by MPW's File and Line commands */ |
| 164 | +#define FMT " File \"%.900s\"; line %d # in %s\n" |
| 165 | +#else |
| 166 | + /* This is needed by Emacs' compile command */ |
| 167 | +#define FMT " File \"%.900s\", line %d, in %s\n" |
| 168 | +#endif |
161 | 169 | xfp = fopen(filename, "r"); |
162 | 170 | if (xfp == NULL) { |
163 | 171 | /* Search tail of filename in sys.path before giving up */ |
@@ -189,16 +197,7 @@ tb_displayline(f, filename, lineno) |
189 | 197 | } |
190 | 198 | } |
191 | 199 | } |
192 | | - sprintf(linebuf, " File \"%.900s\"%s line %d\n", |
193 | | - filename, |
194 | | -#ifdef applec /* MPW */ |
195 | | - /* This is needed by MPW's File and Line commands */ |
196 | | - ";", |
197 | | -#else |
198 | | - /* This is needed by Emacs' compile command */ |
199 | | - ",", |
200 | | -#endif |
201 | | - lineno); |
| 200 | + sprintf(linebuf, FMT, filename, lineno, name); |
202 | 201 | writestring(linebuf, f); |
203 | 202 | if (xfp == NULL) |
204 | 203 | return; |
@@ -234,7 +233,8 @@ tb_printinternal(tb, f, limit) |
234 | 233 | if (depth <= limit) |
235 | 234 | tb_displayline(f, |
236 | 235 | getstringvalue(tb->tb_frame->f_code->co_filename), |
237 | | - tb->tb_lineno); |
| 236 | + tb->tb_lineno, |
| 237 | + getstringvalue(tb->tb_frame->f_code->co_name)); |
238 | 238 | depth--; |
239 | 239 | tb = tb->tb_next; |
240 | 240 | } |
|
0 commit comments