Cython cannot return value and array to Python

I am calling Cython function from Python. And I tried to return memoryview from Cython as np.asarray (np.asarray(best_sol)), and also best_cost as double. However, I failed to obtain both outputs from Python when I try to print out optimized_sol. Why?

My python code used to call function in Cython below

optimized_sol =, xy, t_max, t_min, step_max, alpha)

My Cython function below

cpdef sa(int[:] tour, double[:, :] xy, double tmax, double tmin, int stepmax, double alpha_):

cdef double t_max = tmax
cdef double t = t_max
cdef double t_min = tmin
cdef int step_max = stepmax
cdef double alpha = alpha_
cdef double rand_num

cdef double[:, :] coords = xy
cdef int[:] current_sol = tour
cdef double current_cost = dist(current_sol, coords)
cdef int[:] best_sol = current_sol
cdef double best_cost = current_cost

cdef int step = 1

while step < step_max and t >= t_min:
    new_tour = swap_nodes(current_sol)
    E_n = dist(new_tour, coords)
    dE = E_n - best_cost

    if dE < 0:
        best_cost = E_n
        best_sol = new_tour

        if np.random.rand() < exp(-(dE)/t):
            current_cost = E_n
            current_sol = new_tour

    t = alpha * t
    step += 1

return np.asarray(best_sol), best_cost