Skip to content

Commit a58aada

Browse files
committed
Stack walk tests: handle gracefully if assertions are not enabled
1 parent 9e66f40 commit a58aada

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_indirect_call.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,17 @@
5656
STABILIZES_AT = 1 if sys.implementation.name != "graalpy" or __graalpython__.truffle_runtime == 'Interpreted' else 10
5757
STABILIZES_AT = int(os.environ.get('GRAALPY_TEST_INDIRECT_CALL_STABILIZES_AT', STABILIZES_AT))
5858

59+
has_stack_walk_check = False
60+
if sys.implementation.name == "graalpy":
61+
result = __graalpython__.was_stack_walk(False)
62+
if result is None:
63+
print("NOTE: assertions are not enabled; test_indirect_call cannot check for "
64+
"repeated stack walks and will perform only basic sanity checks")
65+
else:
66+
has_stack_walk_check = True
67+
5968
def was_stack_walk(new_value):
60-
if sys.implementation.name == "graalpy":
69+
if has_stack_walk_check:
6170
return __graalpython__.was_stack_walk(new_value)
6271
return False
6372

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/GraalPythonModuleBuiltins.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,9 @@ public Object doBoundary(Object value) {
637637
boolean assertionsEnabled = false;
638638
assert assertionsEnabled = true;
639639
if (!assertionsEnabled) {
640-
// It does not make sense to run with if assertions are not enabled
641-
throw PRaiseNode.raiseStatic(this, PythonBuiltinClassType.SystemError);
640+
// None indicates that assertions are disabled and this functionality is not
641+
// available
642+
return PNone.NONE;
642643
}
643644

644645
boolean prev = PythonContext.get(this).wasStackWalk;

0 commit comments

Comments
 (0)