Required prerequisites
What version (or hash if on master) of pybind11 are you using?
3.0.1
Problem description
c++ wrapper.cc
PYBIND11_MODULE(demo, m, py::mod_gil_not_used()) {
m.def(
"callback",
[](py::function cb) {
cb("aaa");
cb("bbb");
std::future<void> f1 = std::async(std::launch::async, [cb] {
cb("aaa");
});
std::future<void> f2 = std::async(std::launch::async, [cb] {
cb("bbb");
});
f1.get();
f2.get();
},
"Call a Python callback from C++");
}
demo.py:
def fun(a):
print("Hello", a)
import time
time.sleep(3)
print("Hello-----", a)
kcal.callback(fun)
When I run this function, the program raise "Segmentation fault (core dumped)"
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression