You need to check that row_x and row_y is not NULL. In that case, the error message is already added.

row_x = CudaNdarray_Subscript(x_obj, x_rowind_obj);
if(row_x == NULL){Py_XDECREF(x_rowind_obj, y_rowind_obj, x_obj, y_obj, row_x, row_y); %(fail)s}
row_y = CudaNdarray_Subscript(y_obj, y_rowind_obj);
if(row_y == NULL){Py_XDECREF(x_rowind_obj, y_rowind_obj, x_obj, y_obj, row_x, row_y);%(fail)s}

You also need to check if inplace_elemwise returned an error message:

if(CudaNdarray_inplace_elemwise(row_x, row_y, IADD) != 0){Py_XDECREF(x_rowind_obj, y_rowind_obj, x_obj, y_obj, row_x, row_y);%(fail)s}