I think you should make it recursive once the copy is done to be sure the call to PyArray_xxx is always the same.
(pyarray_new<long> -> pyarray_new<npy_intp> -> PyArray_xxx)