Skip to content

Commit a109185

Browse files
committed
Fit gil lock for new version of pybind11
1 parent fb571d6 commit a109185

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

bmf/engine/c_engine/src/loader/py_module_loader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class PyModuleFactory : public ModuleFactoryI {
185185

186186
std::shared_ptr<Module> make(int32_t node_id,
187187
const JsonParam &json_param) override {
188+
py::gil_scoped_acquire gil;
188189
auto [module_cls, _] = factory_();
189190
return std::make_shared<bmf_sdk::PyModule>(module_cls, node_id,
190191
json_param);
@@ -263,7 +264,6 @@ bmf_import_py_module(const char *module_path, const char *module,
263264
std::string cls_s(cls);
264265
std::string register_info_func = "register_" + cls_s + "_info";
265266
auto module_factory = [=]() -> std::tuple<py::object, py::object> {
266-
py::gil_scoped_acquire gil;
267267
auto py_module = py::module_::import(temp_module_name.c_str());
268268
auto module_cls = py_module.attr(cls_s.c_str());
269269
py::object module_info_register = py::none();
@@ -273,6 +273,7 @@ bmf_import_py_module(const char *module_path, const char *module,
273273
}
274274
return std::make_tuple(module_cls, module_info_register);
275275
};
276+
276277

277278
return new bmf_sdk::PyModuleFactory(module_factory);
278279
} catch (std::exception &e) {

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,4 @@ else
249249
fi
250250
fi
251251
fi
252+
# test github ci, do not merge!

0 commit comments

Comments
 (0)