summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-08-20 18:22:03 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-08-20 18:22:03 (GMT)
commit3766572a488562b06e54d2484fb184eb3c87a9e0 (patch)
tree0f5f9d7365d904331b1b5832aeba605bc4827363 /Objects/exceptions.c
parent7649b24c04b7a396a7a5135f2a5910961d1e15bb (diff)
downloadcpython-3766572a488562b06e54d2484fb184eb3c87a9e0.zip
cpython-3766572a488562b06e54d2484fb184eb3c87a9e0.tar.gz
cpython-3766572a488562b06e54d2484fb184eb3c87a9e0.tar.bz2
Issue #27692: Removed unnecessary NULL checks in exceptions.c.
Patch by Xiang Zhang.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index f829d32..e85d743 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -230,7 +230,7 @@ BaseException_set_tb(PyBaseExceptionObject *self, PyObject *tb)
return -1;
}
- Py_XINCREF(tb);
+ Py_INCREF(tb);
Py_XSETREF(self->traceback, tb);
return 0;
}
@@ -985,7 +985,7 @@ OSError_init(PyOSErrorObject *self, PyObject *args, PyObject *kwds)
return 0;
error:
- Py_XDECREF(args);
+ Py_DECREF(args);
return -1;
}
@@ -1065,8 +1065,7 @@ OSError_str(PyOSErrorObject *self)
}
if (self->myerrno && self->strerror)
return PyUnicode_FromFormat("[Errno %S] %S",
- self->myerrno ? self->myerrno: Py_None,
- self->strerror ? self->strerror: Py_None);
+ self->myerrno, self->strerror);
return BaseException_str((PyBaseExceptionObject *)self);
}