Commit 3766572a authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #27692: Removed unnecessary NULL checks in exceptions.c.

Patch by Xiang Zhang.
parent 7649b24c
...@@ -230,7 +230,7 @@ BaseException_set_tb(PyBaseExceptionObject *self, PyObject *tb) ...@@ -230,7 +230,7 @@ BaseException_set_tb(PyBaseExceptionObject *self, PyObject *tb)
return -1; return -1;
} }
Py_XINCREF(tb); Py_INCREF(tb);
Py_XSETREF(self->traceback, tb); Py_XSETREF(self->traceback, tb);
return 0; return 0;
} }
...@@ -985,7 +985,7 @@ OSError_init(PyOSErrorObject *self, PyObject *args, PyObject *kwds) ...@@ -985,7 +985,7 @@ OSError_init(PyOSErrorObject *self, PyObject *args, PyObject *kwds)
return 0; return 0;
error: error:
Py_XDECREF(args); Py_DECREF(args);
return -1; return -1;
} }
...@@ -1065,8 +1065,7 @@ OSError_str(PyOSErrorObject *self) ...@@ -1065,8 +1065,7 @@ OSError_str(PyOSErrorObject *self)
} }
if (self->myerrno && self->strerror) if (self->myerrno && self->strerror)
return PyUnicode_FromFormat("[Errno %S] %S", return PyUnicode_FromFormat("[Errno %S] %S",
self->myerrno ? self->myerrno: Py_None, self->myerrno, self->strerror);
self->strerror ? self->strerror: Py_None);
return BaseException_str((PyBaseExceptionObject *)self); return BaseException_str((PyBaseExceptionObject *)self);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment