Unverified Commit 5e687c30 authored by Raimondas Galvelis's avatar Raimondas Galvelis Committed by GitHub
Browse files

Fix GIL for OpenMM::CustomCVForce::getCollectiveVariableValues (#3463)

parent 4358f071
......@@ -65,3 +65,17 @@
}
PyEval_RestoreThread(_savePythonThreadState);
}
%exception OpenMM::CustomCVForce::getCollectiveVariableValues {
PyThreadState* _savePythonThreadState = PyEval_SaveThread();
try {
$action
} catch (std::exception &e) {
PyEval_RestoreThread(_savePythonThreadState);
PyObject* mm = PyImport_AddModule("openmm");
PyObject* openmm_exception = PyObject_GetAttrString(mm, "OpenMMException");
PyErr_SetString(openmm_exception, const_cast<char*>(e.what()));
return NULL;
}
PyEval_RestoreThread(_savePythonThreadState);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment