mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
PyErr_Print(): Use PyErr_GivenExceptionMatches() instead of pointer
compares to test for SystemExit and SyntaxError.
This commit is contained in:
parent
26726fe523
commit
36b8f945e7
1 changed files with 4 additions and 2 deletions
|
@ -530,7 +530,7 @@ PyErr_Print()
|
||||||
PyErr_Fetch(&exception, &v, &tb);
|
PyErr_Fetch(&exception, &v, &tb);
|
||||||
if (exception == NULL)
|
if (exception == NULL)
|
||||||
return;
|
return;
|
||||||
if (exception == PyExc_SystemExit) {
|
if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) {
|
||||||
err = Py_FlushLine();
|
err = Py_FlushLine();
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (v == NULL || v == Py_None)
|
if (v == NULL || v == Py_None)
|
||||||
|
@ -555,7 +555,9 @@ PyErr_Print()
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
err = PyTraceBack_Print(tb, f);
|
err = PyTraceBack_Print(tb, f);
|
||||||
if (err == 0 && exception == PyExc_SyntaxError) {
|
if (err == 0 &&
|
||||||
|
PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError))
|
||||||
|
{
|
||||||
PyObject *message;
|
PyObject *message;
|
||||||
char *filename, *text;
|
char *filename, *text;
|
||||||
int lineno, offset;
|
int lineno, offset;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue