mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Fix garbage collection issue with closure in Python 3.10
This commit is contained in:
@@ -19,10 +19,8 @@ namespace details {
|
||||
*/
|
||||
template <class ReturnType, class WrapperTypePtr, class Fn, class... Args>
|
||||
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<Fn, std::nullptr_t>) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user