- Fails only with numpy and
py::array_t
and "single"py::scoped_interpreter
(~> branchmain
) - Does not fail, when having only single
py::scoped_interpreter
(~> branchworks_when_having_only_single_scoped_interpreter
-> see diff): why? - Does not fail, when changing to
py::list
(~> branchworks_when_removing_numpy
-> see diff): why?
mkdir build/
cd build/
cmake .. # will clone https://github.com/pybind/pybind11.git (stable)
cmake --build . -j # will also copy mysum.py into the build/ directory
./go # run (need a python with numpy)
The result is:
Sum is: 15
double free or corruption (out)
Aborted (core dumped)
It fails in this line, but only the 2nd time through the loop!!!
So if I simply change the following line
constexpr int NUM_LOOPS = 2;
to this
constexpr int NUM_LOOPS = 1;
then it will not fail.
Why does it fail with NUM_LOOPS = 2
?
How can one fix it?
Thanks