Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 22121:d4406fbfcb4e 2.2
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:32:01 +0000 |
| parents | e223397b26fa |
| children | c0dd8bbdde60 eebae4f60d05 |
comparison
equal
deleted
inserted
replaced
| 22119:0859e764509e | 22121:d4406fbfcb4e |
|---|---|
| 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, |
