Fix GIL-not-held bug in mjr_readPixels.

PiperOrigin-RevId: 441813459
Change-Id: I2f15cb77ca243b890fd0825ebbc9b910d3ece56f
This commit is contained in:
Saran Tunyasuvunakool
2022-04-14 11:34:43 -07:00
committed by Copybara-Service
parent 87539dbd24
commit 0e5d062302
2 changed files with 20 additions and 6 deletions
+8
View File
@@ -192,6 +192,14 @@ static constexpr void Def(
::pybind11::call_guard<::pybind11::gil_scoped_release>());
}
template <typename MjTraits, typename Func>
MUJOCO_ALWAYS_INLINE
static constexpr void DefWithGil(::pybind11::module_& m, Func&& func) {
WithNamedArgs(MjTraits::param_names).def(
m, MjTraits::name, util::UnwrapArgs(std::forward<Func>(func)),
::pybind11::doc(MjTraits::doc));
}
// Should only be invoked via the DEF_WITH_OMITTED_PY_ARGS macro.
template <typename MjTraits, typename OmittedArgsTuple>
struct DefWithOmittedPyArgsImpl {