Commit 9f9cac52 authored by peastman's avatar peastman
Browse files

Merge pull request #133 from peastman/master

Handle exceptions correctly inside getState()
parents 559c7cff 44c8ea9c
...@@ -14,7 +14,13 @@ ...@@ -14,7 +14,13 @@
if (getForces) types |= State::Forces; if (getForces) types |= State::Forces;
if (getEnergy) types |= State::Energy; if (getEnergy) types |= State::Energy;
if (getParameters) types |= State::Parameters; if (getParameters) types |= State::Parameters;
state = self->getState(types, enforcePeriodic, groups); try {
state = self->getState(types, enforcePeriodic, groups);
}
catch (...) {
Py_END_ALLOW_THREADS
throw;
}
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
return _convertStateToLists(state); return _convertStateToLists(state);
} }
...@@ -157,7 +163,13 @@ Parameters: ...@@ -157,7 +163,13 @@ Parameters:
if (getForces) types |= State::Forces; if (getForces) types |= State::Forces;
if (getEnergy) types |= State::Energy; if (getEnergy) types |= State::Energy;
if (getParameters) types |= State::Parameters; if (getParameters) types |= State::Parameters;
state = self->getState(copy, types, enforcePeriodic, groups); try {
state = self->getState(copy, types, enforcePeriodic, groups);
}
catch (...) {
Py_END_ALLOW_THREADS
throw;
}
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
return _convertStateToLists(state); return _convertStateToLists(state);
} }
......
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