Numpy.to_bigarray causes a segfault when passed a python object with the wrong type
jonathan-laurent opened this issue · 3 comments
jonathan-laurent commented
The following code causes a segfault:
let () =
Py.initialize;
Numpy.to_bigarray Float64 C_layout Py.none
Would it be possible for Numpy.to_bigarray
to raise an exception instead (as is done byPy.Int.to_int
for example)?
thierry-martinez commented
Thank you very much for reporting! This should be fixed now.
jonathan-laurent commented
Thanks for your answer!
However, your fix only applies to the case where None
is passed and indeed, the code below still segfaults:
let () =
Py.initialize;
Numpy.to_bigarray Float64 C_layout (Py.Int.of_int 2)
Would there be a way for Numpy.to_bigarray
to check whether the passed object is indeed a numpy array?
thierry-martinez commented
Oops! Sorry for that. Done!