In pybind11-wrapped c++, called from python, I can do this:
py::array_t<double> t1 = py::array_t<double>(3);
But: if I do that in a separate thread, it crashes with a segmentation fault (actually it seems to crash when t1 goes out of scope or gets destructed).
I can fix this by doing
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
pybind11::array_t<double> t1 = pybind11::array_t<double>(3)
PyGILState_Release(gstate);
So obviously there is some GIL-dependent stuff in pybind11::array_t. Is it necessarily so? Do I have to acquire the GIL in order to instantiate it?