comparison Python/pythonrun.c @ 22120:b2a2cc0c2a63 legacy-trunk

Patch #50002: Display line information for bad \x escapes: - recognize "SyntaxError"s by the print_file_and_line attribute. - add the syntaxerror attributes to all exceptions in compile.c. Fixes #221791
author Martin v. Löwis <martin@v.loewis.de>
date Sun, 03 Mar 2002 21:30:27 +0000
parents d4406fbfcb4e
children c0dd8bbdde60 eebae4f60d05
comparison
equal deleted inserted replaced
22118:cbc08b172d1f 22120:b2a2cc0c2a63
918 PyErr_Clear(); 918 PyErr_Clear();
919 fflush(stdout); 919 fflush(stdout);
920 if (tb && tb != Py_None) 920 if (tb && tb != Py_None)
921 err = PyTraceBack_Print(tb, f); 921 err = PyTraceBack_Print(tb, f);
922 if (err == 0 && 922 if (err == 0 &&
923 PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) 923 PyObject_HasAttrString(v, "print_file_and_line"))
924 { 924 {
925 PyObject *message; 925 PyObject *message;
926 char *filename, *text; 926 char *filename, *text;
927 int lineno, offset; 927 int lineno, offset;
928 if (!parse_syntax_error(v, &message, &filename, 928 if (!parse_syntax_error(v, &message, &filename,