diff --git a/src/runner/pythonwrapperutilities.h b/src/runner/pythonwrapperutilities.h index a55025c..879b8d4 100644 --- a/src/runner/pythonwrapperutilities.h +++ b/src/runner/pythonwrapperutilities.h @@ -19,10 +19,8 @@ namespace details { */ template ReturnType wrapperFunctionImplementation(WrapperTypePtr wrapper, bool apiTransfer, Fn fn, boost::python::object* objPtr, const char *methodName, Args... args) { - boost::python::override implementation = [&]() { - GILock lock; - return wrapper->get_override(methodName); - }(); + GILock lock; + auto implementation = wrapper->get_override(methodName); if (!implementation) { if constexpr (std::is_same_v) { throw pyexcept::MissingImplementation(wrapper->className, methodName); @@ -31,8 +29,6 @@ namespace details { return std::invoke(fn, wrapper, args...); } } - - GILock lock; try { boost::python::object result = implementation(args...); if (objPtr) {