diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTry.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTry.java index 53cf1f0e42896f1d33eff6993c57d6e7d8427cb7..1fb8fe48ae08c4551fbc0fb2c441b8c4930397a5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTry.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTry.java @@ -30,6 +30,8 @@ import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.function.call.RExplicitCallNode; +import com.oracle.truffle.r.runtime.RErrorHandling; +import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames; @@ -53,6 +55,9 @@ public abstract class FastRTry extends RBuiltinNode.Arg1 { try { call.execute(frame, func, RArgsValuesAndNames.EMPTY); } catch (Throwable ex) { + // try to recover from a possibly incosistent state when running tests: + // some handlers might still be lying around and interfere with subsequent calls + RErrorHandling.resetStacks(); return formatError(ex); } return RRuntime.LOGICAL_TRUE;