Use PyArray_AsCArray to access np array data as a c array.

This function is provided by the Numpy array API, and it should be
better than the hand-coded version I was using before.