]> granicus.if.org Git - python/commitdiff
Issue #27703: Got rid of unnecessary NULL checks in do_raise() in release mode.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 27 Sep 2016 08:37:10 +0000 (11:37 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 27 Sep 2016 08:37:10 +0000 (11:37 +0300)
Patch by Xiang Zhang.

Python/ceval.c

index 39cf33019d8130335532837b030a58c3534d1175..a09de05ebed6a51deb5fde46516e80bf2fb7b074 100644 (file)
@@ -4245,6 +4245,9 @@ do_raise(PyObject *exc, PyObject *cause)
         goto raise_error;
     }
 
+    assert(type != NULL);
+    assert(value != NULL);
+
     if (cause) {
         PyObject *fixed_cause;
         if (PyExceptionClass_Check(cause)) {
@@ -4271,8 +4274,8 @@ do_raise(PyObject *exc, PyObject *cause)
 
     PyErr_SetObject(type, value);
     /* PyErr_SetObject incref's its arguments */
-    Py_XDECREF(value);
-    Py_XDECREF(type);
+    Py_DECREF(value);
+    Py_DECREF(type);
     return 0;
 
 raise_error: