Fix for #5313: PyArray_AsCArray caused segfault with 3D-arrays