Mercurial > cpython-lru_cache-weakref
annotate Python/traceback.c @ 5372:424922afc1bb legacy-trunk
Quickly renamed.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 29 Apr 1997 18:33:38 +0000 |
| parents | c72c7e1930b3 |
| children | 3780cce14f7d |
| rev | line source |
|---|---|
| 145 | 1 /*********************************************************** |
|
2062
d0d0a69b5ca3
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
2052
diff
changeset
|
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
|
d0d0a69b5ca3
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
2052
diff
changeset
|
3 The Netherlands. |
| 145 | 4 |
| 5 All Rights Reserved | |
| 6 | |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
7 Permission to use, copy, modify, and distribute this software and its |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
8 documentation for any purpose and without fee is hereby granted, |
| 145 | 9 provided that the above copyright notice appear in all copies and that |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
10 both that copyright notice and this permission notice appear in |
| 145 | 11 supporting documentation, and that the names of Stichting Mathematisch |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
12 Centrum or CWI or Corporation for National Research Initiatives or |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
13 CNRI not be used in advertising or publicity pertaining to |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
14 distribution of the software without specific, written prior |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
15 permission. |
| 145 | 16 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
17 While CWI is the initial source for this software, a modified version |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
18 is made available by the Corporation for National Research Initiatives |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
19 (CNRI) at the Internet address ftp://ftp.python.org. |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
20 |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3099
diff
changeset
|
28 PERFORMANCE OF THIS SOFTWARE. |
| 145 | 29 |
| 30 ******************************************************************/ | |
| 31 | |
| 86 | 32 /* Traceback implementation */ |
| 33 | |
| 5372 | 34 #include "Python.h" |
| 86 | 35 |
| 36 #include "compile.h" | |
| 37 #include "frameobject.h" | |
| 38 #include "structmember.h" | |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
39 #include "osdefs.h" |
| 86 | 40 |
| 41 typedef struct _tracebackobject { | |
| 5372 | 42 PyObject_HEAD |
| 86 | 43 struct _tracebackobject *tb_next; |
| 5372 | 44 PyFrameObject *tb_frame; |
| 86 | 45 int tb_lasti; |
| 46 int tb_lineno; | |
| 47 } tracebackobject; | |
| 48 | |
| 49 #define OFF(x) offsetof(tracebackobject, x) | |
| 50 | |
| 51 static struct memberlist tb_memberlist[] = { | |
| 52 {"tb_next", T_OBJECT, OFF(tb_next)}, | |
| 53 {"tb_frame", T_OBJECT, OFF(tb_frame)}, | |
| 54 {"tb_lasti", T_INT, OFF(tb_lasti)}, | |
| 55 {"tb_lineno", T_INT, OFF(tb_lineno)}, | |
| 56 {NULL} /* Sentinel */ | |
| 57 }; | |
| 58 | |
| 5372 | 59 static PyObject * |
| 86 | 60 tb_getattr(tb, name) |
| 61 tracebackobject *tb; | |
| 62 char *name; | |
| 63 { | |
| 5372 | 64 return PyMember_Get((char *)tb, tb_memberlist, name); |
| 86 | 65 } |
| 66 | |
| 67 static void | |
| 68 tb_dealloc(tb) | |
| 69 tracebackobject *tb; | |
| 70 { | |
| 5372 | 71 Py_XDECREF(tb->tb_next); |
| 72 Py_XDECREF(tb->tb_frame); | |
| 73 PyMem_DEL(tb); | |
| 86 | 74 } |
| 75 | |
|
3099
d249111d4ccc
spell TraceBack with capital B
Guido van Rossum <guido@python.org>
parents:
2844
diff
changeset
|
76 #define Tracebacktype PyTraceBack_Type |
|
d249111d4ccc
spell TraceBack with capital B
Guido van Rossum <guido@python.org>
parents:
2844
diff
changeset
|
77 #define is_tracebackobject PyTraceBack_Check |
|
2844
0261bf5b3819
keyword arguments and faster calls
Guido van Rossum <guido@python.org>
parents:
2811
diff
changeset
|
78 |
| 5372 | 79 PyTypeObject Tracebacktype = { |
| 80 PyObject_HEAD_INIT(&PyType_Type) | |
| 86 | 81 0, |
| 82 "traceback", | |
| 83 sizeof(tracebackobject), | |
| 84 0, | |
|
1831
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
85 (destructor)tb_dealloc, /*tp_dealloc*/ |
| 86 | 86 0, /*tp_print*/ |
|
1831
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
87 (getattrfunc)tb_getattr, /*tp_getattr*/ |
| 86 | 88 0, /*tp_setattr*/ |
| 89 0, /*tp_compare*/ | |
| 90 0, /*tp_repr*/ | |
| 91 0, /*tp_as_number*/ | |
| 92 0, /*tp_as_sequence*/ | |
| 93 0, /*tp_as_mapping*/ | |
| 94 }; | |
| 95 | |
| 96 static tracebackobject * | |
| 97 newtracebackobject(next, frame, lasti, lineno) | |
| 98 tracebackobject *next; | |
| 5372 | 99 PyFrameObject *frame; |
| 86 | 100 int lasti, lineno; |
| 101 { | |
| 102 tracebackobject *tb; | |
| 103 if ((next != NULL && !is_tracebackobject(next)) || | |
| 5372 | 104 frame == NULL || !PyFrame_Check(frame)) { |
| 105 PyErr_BadInternalCall(); | |
| 86 | 106 return NULL; |
| 107 } | |
| 5372 | 108 tb = PyObject_NEW(tracebackobject, &Tracebacktype); |
| 86 | 109 if (tb != NULL) { |
| 5372 | 110 Py_XINCREF(next); |
| 86 | 111 tb->tb_next = next; |
| 5372 | 112 Py_XINCREF(frame); |
| 86 | 113 tb->tb_frame = frame; |
| 114 tb->tb_lasti = lasti; | |
| 115 tb->tb_lineno = lineno; | |
| 116 } | |
| 117 return tb; | |
| 118 } | |
| 119 | |
| 120 static tracebackobject *tb_current = NULL; | |
| 121 | |
| 122 int | |
| 5372 | 123 PyTraceBack_Here(frame) |
| 124 PyFrameObject *frame; | |
| 86 | 125 { |
| 126 tracebackobject *tb; | |
| 5372 | 127 tb = newtracebackobject(tb_current, frame, |
| 128 frame->f_lasti, frame->f_lineno); | |
| 86 | 129 if (tb == NULL) |
| 130 return -1; | |
| 5372 | 131 Py_XDECREF(tb_current); |
| 86 | 132 tb_current = tb; |
| 133 return 0; | |
| 134 } | |
| 135 | |
| 5372 | 136 PyObject * |
| 137 PyTraceBack_Fetch() | |
| 86 | 138 { |
| 5372 | 139 PyObject *v; |
| 140 v = (PyObject *)tb_current; | |
| 86 | 141 tb_current = NULL; |
| 142 return v; | |
| 143 } | |
| 144 | |
| 145 int | |
| 5372 | 146 PyTraceBack_Store(v) |
| 147 PyObject *v; | |
| 86 | 148 { |
| 149 if (v != NULL && !is_tracebackobject(v)) { | |
| 5372 | 150 PyErr_BadInternalCall(); |
| 86 | 151 return -1; |
| 152 } | |
| 5372 | 153 Py_XDECREF(tb_current); |
| 154 Py_XINCREF(v); | |
| 86 | 155 tb_current = (tracebackobject *)v; |
| 156 return 0; | |
| 157 } | |
| 158 | |
| 159 static void | |
|
1831
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
160 tb_displayline(f, filename, lineno, name) |
| 5372 | 161 PyObject *f; |
| 86 | 162 char *filename; |
| 163 int lineno; | |
|
1831
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
164 char *name; |
| 86 | 165 { |
| 166 FILE *xfp; | |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
167 char linebuf[1000]; |
| 86 | 168 int i; |
|
1831
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
169 #ifdef MPW |
|
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
170 /* This is needed by MPW's File and Line commands */ |
|
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
171 #define FMT " File \"%.900s\"; line %d # in %s\n" |
|
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
172 #else |
|
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
173 /* This is needed by Emacs' compile command */ |
|
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
174 #define FMT " File \"%.900s\", line %d, in %s\n" |
|
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
175 #endif |
| 86 | 176 xfp = fopen(filename, "r"); |
| 177 if (xfp == NULL) { | |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
178 /* Search tail of filename in sys.path before giving up */ |
| 5372 | 179 PyObject *path; |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
180 char *tail = strrchr(filename, SEP); |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
181 if (tail == NULL) |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
182 tail = filename; |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
183 else |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
184 tail++; |
| 5372 | 185 path = PySys_GetObject("path"); |
| 186 if (path != NULL && PyList_Check(path)) { | |
| 187 int npath = PyList_Size(path); | |
|
1909
0c232194a64f
* Python/traceback.c: security fix -- check for buffer oveflow
Guido van Rossum <guido@python.org>
parents:
1831
diff
changeset
|
188 int taillen = strlen(tail); |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
189 char namebuf[MAXPATHLEN+1]; |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
190 for (i = 0; i < npath; i++) { |
| 5372 | 191 PyObject *v = PyList_GetItem(path, i); |
| 192 if (PyString_Check(v)) { | |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
193 int len; |
| 5372 | 194 len = PyString_Size(v); |
|
1909
0c232194a64f
* Python/traceback.c: security fix -- check for buffer oveflow
Guido van Rossum <guido@python.org>
parents:
1831
diff
changeset
|
195 if (len + 1 + taillen >= MAXPATHLEN) |
|
0c232194a64f
* Python/traceback.c: security fix -- check for buffer oveflow
Guido van Rossum <guido@python.org>
parents:
1831
diff
changeset
|
196 continue; /* Too long */ |
| 5372 | 197 strcpy(namebuf, PyString_AsString(v)); |
|
5317
c72c7e1930b3
Keep gcc -Wall and Microsoft VC happy.
Guido van Rossum <guido@python.org>
parents:
5046
diff
changeset
|
198 if ((int)strlen(namebuf) != len) |
|
1909
0c232194a64f
* Python/traceback.c: security fix -- check for buffer oveflow
Guido van Rossum <guido@python.org>
parents:
1831
diff
changeset
|
199 continue; /* v contains '\0' */ |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
200 if (len > 0 && namebuf[len-1] != SEP) |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
201 namebuf[len++] = SEP; |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
202 strcpy(namebuf+len, tail); |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
203 xfp = fopen(namebuf, "r"); |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
204 if (xfp != NULL) { |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
205 filename = namebuf; |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
206 break; |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
207 } |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
208 } |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
209 } |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
210 } |
| 86 | 211 } |
|
1831
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
212 sprintf(linebuf, FMT, filename, lineno, name); |
| 5372 | 213 PyFile_WriteString(linebuf, f); |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
214 if (xfp == NULL) |
|
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
215 return; |
| 86 | 216 for (i = 0; i < lineno; i++) { |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
217 if (fgets(linebuf, sizeof linebuf, xfp) == NULL) |
| 86 | 218 break; |
| 219 } | |
| 220 if (i == lineno) { | |
|
674
4e2d239dc64c
Move printing of filename and lineno to tb_displayline.
Guido van Rossum <guido@python.org>
parents:
597
diff
changeset
|
221 char *p = linebuf; |
|
2811
07fc4fefb683
ignore control-l (parallelling change to tokenizer.c)
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
222 while (*p == ' ' || *p == '\t' || *p == '\014') |
| 86 | 223 p++; |
| 5372 | 224 PyFile_WriteString(" ", f); |
| 225 PyFile_WriteString(p, f); | |
| 86 | 226 if (strchr(p, '\n') == NULL) |
| 5372 | 227 PyFile_WriteString("\n", f); |
| 86 | 228 } |
| 229 fclose(xfp); | |
| 230 } | |
| 231 | |
| 232 static void | |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
233 tb_printinternal(tb, f, limit) |
| 86 | 234 tracebackobject *tb; |
| 5372 | 235 PyObject *f; |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
236 int limit; |
| 86 | 237 { |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
238 int depth = 0; |
|
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
239 tracebackobject *tb1 = tb; |
|
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
240 while (tb1 != NULL) { |
|
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
241 depth++; |
|
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
242 tb1 = tb1->tb_next; |
|
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
243 } |
| 5372 | 244 while (tb != NULL && !PyOS_InterruptOccurred()) { |
|
5046
658815230546
Get the line number from PyCode_Addr2Line instead of believing
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
245 if (depth <= limit) { |
|
658815230546
Get the line number from PyCode_Addr2Line instead of believing
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
246 tb->tb_lineno = PyCode_Addr2Line(tb->tb_frame->f_code, |
|
658815230546
Get the line number from PyCode_Addr2Line instead of believing
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
247 tb->tb_lasti); |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
248 tb_displayline(f, |
| 5372 | 249 PyString_AsString( |
| 250 tb->tb_frame->f_code->co_filename), | |
|
1831
216b755515e6
add function name to traceback info
Guido van Rossum <guido@python.org>
parents:
1425
diff
changeset
|
251 tb->tb_lineno, |
| 5372 | 252 PyString_AsString(tb->tb_frame->f_code->co_name)); |
|
5046
658815230546
Get the line number from PyCode_Addr2Line instead of believing
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
253 } |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
254 depth--; |
| 86 | 255 tb = tb->tb_next; |
| 256 } | |
| 257 } | |
| 258 | |
| 259 int | |
| 5372 | 260 PyTraceBack_Print(v, f) |
| 261 PyObject *v; | |
| 262 PyObject *f; | |
| 86 | 263 { |
| 5372 | 264 PyObject *limitv; |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
265 int limit = 1000; |
| 86 | 266 if (v == NULL) |
| 267 return 0; | |
| 268 if (!is_tracebackobject(v)) { | |
| 5372 | 269 PyErr_BadInternalCall(); |
| 86 | 270 return -1; |
| 271 } | |
| 5372 | 272 limitv = PySys_GetObject("tracebacklimit"); |
| 273 if (limitv && PyInt_Check(limitv)) { | |
| 274 limit = PyInt_AsLong(limitv); | |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
275 if (limit <= 0) |
|
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
276 return 0; |
|
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
277 } |
| 5372 | 278 PyFile_WriteString("Traceback (innermost last):\n", f); |
|
1425
72bddfad351a
* mpzmodule.c: cast some methods to the proper type.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
279 tb_printinternal((tracebackobject *)v, f, limit); |
| 86 | 280 return 0; |
| 281 } |
