Mercurial > cpython-lru_cache-weakref
comparison Python/_warnings.c @ 48474:2ee09afee126
implement chained exception tracebacks
patch from Antoine Pitrou #3112
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Tue, 15 Jul 2008 15:32:09 +0000 |
| parents | 605ab6f92838 |
| children | de0bf60f1245 |
comparison
equal
deleted
inserted
replaced
| 48473:7d570df5e90a | 48474:2ee09afee126 |
|---|---|
| 254 PyFile_WriteObject(text, f_stderr, Py_PRINT_RAW); | 254 PyFile_WriteObject(text, f_stderr, Py_PRINT_RAW); |
| 255 PyFile_WriteString("\n", f_stderr); | 255 PyFile_WriteString("\n", f_stderr); |
| 256 Py_XDECREF(name); | 256 Py_XDECREF(name); |
| 257 | 257 |
| 258 /* Print " source_line\n" */ | 258 /* Print " source_line\n" */ |
| 259 PyFile_WriteString(" ", f_stderr); | |
| 260 if (sourceline) { | 259 if (sourceline) { |
| 261 char *source_line_str = PyUnicode_AsString(sourceline); | 260 char *source_line_str = PyUnicode_AsString(sourceline); |
| 262 while (*source_line_str == ' ' || *source_line_str == '\t' || | 261 while (*source_line_str == ' ' || *source_line_str == '\t' || |
| 263 *source_line_str == '\014') | 262 *source_line_str == '\014') |
| 264 source_line_str++; | 263 source_line_str++; |
| 265 | 264 |
| 266 PyFile_WriteString(source_line_str, f_stderr); | 265 PyFile_WriteString(source_line_str, f_stderr); |
| 267 PyFile_WriteString("\n", f_stderr); | 266 PyFile_WriteString("\n", f_stderr); |
| 268 } | 267 } |
| 269 else | 268 else |
| 270 Py_DisplaySourceLine(f_stderr, PyUnicode_AsString(filename), lineno); | 269 Py_DisplaySourceLine(f_stderr, PyUnicode_AsString(filename), lineno, 2); |
| 271 PyErr_Clear(); | 270 PyErr_Clear(); |
| 272 } | 271 } |
| 273 | 272 |
| 274 static PyObject * | 273 static PyObject * |
| 275 warn_explicit(PyObject *category, PyObject *message, | 274 warn_explicit(PyObject *category, PyObject *message, |
