Closed
Description
Issue description
My application crashes when pybind11::scoped_interpreter
is destructed after importing torch
.
Reproducible example code
#include <pybind11/embed.h>
int main()
{
pybind11::scoped_interpreter guard{};
pybind11::exec("import torch");
// pybind11::module::import("torch"); // same problem
}
Note that the import itself works like a charm.
In the real code, I am using torch and it does what it is supposed to do.
The crash occurs when guard
goes out of scope, i.e., when it is destructed.
I guess it's a double-free issue, however, I can't narrow down the problem in torch
, I believe the problem is somewhere deep in its C-implementation. Importing tensorflow
, numpy
, matplotlib
and other modules does not make such trouble.
I already asked in the gitter lobby, but I didn't get an answer.
Metadata
Metadata
Assignees
Labels
No labels