File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/statement Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ public class AssertNode extends StatementNode {
43
43
@ Child private ExpressionNode message ;
44
44
@ Child private LookupAndCallUnaryNode callNode ;
45
45
@ CompilationFinal private Boolean assertionsEnabled = null ;
46
+ @ CompilationFinal private boolean javaExceptionsFailAsssertions ;
46
47
47
48
public AssertNode (CastToBooleanNode condition , ExpressionNode message ) {
48
49
this .condition = condition ;
@@ -54,6 +55,7 @@ public void executeVoid(VirtualFrame frame) {
54
55
if (assertionsEnabled == null ) {
55
56
CompilerDirectives .transferToInterpreterAndInvalidate ();
56
57
assertionsEnabled = !PythonOptions .getOption (getContext (), PythonOptions .PythonOptimizeFlag );
58
+ javaExceptionsFailAsssertions = PythonOptions .getOption (getContext (), PythonOptions .CatchAllExceptions );
57
59
}
58
60
if (assertionsEnabled ) {
59
61
try {
@@ -64,8 +66,12 @@ public void executeVoid(VirtualFrame frame) {
64
66
// Python exceptions just fall through
65
67
throw e ;
66
68
} catch (Exception e ) {
67
- // catch any other exception and convert to Python exception
68
- throw assertionFailed (frame );
69
+ if (javaExceptionsFailAsssertions ) {
70
+ // catch any other exception and convert to Python exception
71
+ throw assertionFailed (frame );
72
+ } else {
73
+ throw e ;
74
+ }
69
75
}
70
76
}
71
77
}
You can’t perform that action at this time.
0 commit comments