comparison Python/_warnings.c @ 47933:4f804ee772eb legacy-trunk

#3342: In tracebacks, printed source lines were not indented since r62555. #3343: Py_DisplaySourceLine should be a private function. Rename it to _Py_DisplaySourceLine.
author Amaury Forgeot d'Arc <amauryfa@gmail.com>
date Fri, 11 Jul 2008 21:45:06 +0000
parents dc42efd728ee
children d563621d76db
comparison
equal deleted inserted replaced
47932:13e525d974b1 47933:4f804ee772eb
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 = PyString_AS_STRING(sourceline); 260 char *source_line_str = PyString_AS_STRING(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, PyString_AS_STRING(filename), lineno); 269 _Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename),
270 lineno, 2);
271 PyErr_Clear(); 271 PyErr_Clear();
272 } 272 }
273 273
274 static PyObject * 274 static PyObject *
275 warn_explicit(PyObject *category, PyObject *message, 275 warn_explicit(PyObject *category, PyObject *message,