Do not assume anything on the stride when dimension is 1

Also set the Python exception if an error is met.