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