Skip to content

Commit a996cda

Browse files
committed
Avoid an abs()
1 parent b217e3f commit a996cda

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_call.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,12 @@ def get_sp():
10501050
lower_sp = _testcapi.pyobject_vectorcall(get_sp, (), ())
10511051
if _testcapi._Py_STACK_GROWS_DOWN:
10521052
self.assertLess(lower_sp, this_sp)
1053+
safe_margin = this_sp - lower_sp
10531054
else:
10541055
self.assertGreater(lower_sp, this_sp)
1056+
safe_margin = lower_sp - this_sp
10551057
# Add an (arbitrary) extra 25% for safety
1056-
safe_margin = abs(this_sp - lower_sp) * 5 / 4
1058+
safe_margin = safe_margin * 5 / 4
10571059
self.assertLess(safe_margin, _testinternalcapi.get_stack_margin())
10581060

10591061
@skip_on_s390x

0 commit comments

Comments
 (0)