arrays: to_python now raise exception when array is empty

- otherwise it was simply crashing .
- now raise a C++ exception
- adapted cython wrapper to catch it as a python exception