Better Cython exception handling