[Python-checkins] cpython: Issue #27692: Removed unnecessary NULL checks in exceptions.c.

serhiy.storchaka python-checkins at python.org
Sat Aug 20 14:22:46 EDT 2016


https://hg.python.org/cpython/rev/6e6aa2054824
changeset:   102807:6e6aa2054824
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Aug 20 21:22:03 2016 +0300
summary:
  Issue #27692: Removed unnecessary NULL checks in exceptions.c.
Patch by Xiang Zhang.

files:
  Objects/exceptions.c |  7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)


diff --git a/Objects/exceptions.c b/Objects/exceptions.c
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -230,7 +230,7 @@
         return -1;
     }
 
-    Py_XINCREF(tb);
+    Py_INCREF(tb);
     Py_XSETREF(self->traceback, tb);
     return 0;
 }
@@ -985,7 +985,7 @@
     return 0;
 
 error:
-    Py_XDECREF(args);
+    Py_DECREF(args);
     return -1;
 }
 
@@ -1065,8 +1065,7 @@
     }
     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);
 }
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list