Skip to content

Commit 5f794c0

Browse files
committed
Support a stack that grows up in test_call
1 parent 695bbdc commit 5f794c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_call.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,9 +1048,12 @@ def get_sp():
10481048

10491049
this_sp = _testinternalcapi.get_stack_pointer()
10501050
lower_sp = _testcapi.pyobject_vectorcall(get_sp, (), ())
1051-
self.assertLess(lower_sp, this_sp)
1051+
if _testcapi._Py_STACK_GROWS_DOWN:
1052+
self.assertLess(lower_sp, this_sp)
1053+
else:
1054+
self.assertGreater(lower_sp, this_sp)
10521055
# Add an (arbitrary) extra 25% for safety
1053-
safe_margin = (this_sp - lower_sp) * 5 / 4
1056+
safe_margin = abs(this_sp - lower_sp) * 5 / 4
10541057
self.assertLess(safe_margin, _testinternalcapi.get_stack_margin())
10551058

10561059
@skip_on_s390x

0 commit comments

Comments
 (0)