summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1997-08-26 18:09:48 (GMT)
committerBarry Warsaw <barry@python.org>1997-08-26 18:09:48 (GMT)
commit36b8f945e794e8483a185db3b6847c083a724e44 (patch)
tree89451be82bc5d8934d8c153ff6ffa7d7efbe9676 /Python/pythonrun.c
parent26726fe52335d597685cae3246cb1a414e6ec00f (diff)
downloadcpython-36b8f945e794e8483a185db3b6847c083a724e44.zip
cpython-36b8f945e794e8483a185db3b6847c083a724e44.tar.gz
cpython-36b8f945e794e8483a185db3b6847c083a724e44.tar.bz2
PyErr_Print(): Use PyErr_GivenExceptionMatches() instead of pointer
compares to test for SystemExit and SyntaxError.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 22cb86b..c1c5d36 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -530,7 +530,7 @@ PyErr_Print()
PyErr_Fetch(&exception, &v, &tb);
if (exception == NULL)
return;
- if (exception == PyExc_SystemExit) {
+ if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) {
err = Py_FlushLine();
fflush(stdout);
if (v == NULL || v == Py_None)
@@ -555,7 +555,9 @@ PyErr_Print()
fflush(stdout);
if (err == 0)
err = PyTraceBack_Print(tb, f);
- if (err == 0 && exception == PyExc_SyntaxError) {
+ if (err == 0 &&
+ PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError))
+ {
PyObject *message;
char *filename, *text;
int lineno, offset;