https://github.com/python/cpython/commit/faa26044ce8e61f15a7886557d3030a481ebb96d
commit: faa26044ce8e61f15a7886557d3030a481ebb96d
branch: main
author: Ken Jin <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2026-01-01T18:54:49Z
summary:
gh-134584: Fix _CALL_BUILTIN_O test to reflect real-world usage (GH-143333)
Fix test to reflect real-world usage
files:
M Lib/test/test_capi/test_opt.py
diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py
index bb4aa6ff113f47..bff97fe8320b22 100644
--- a/Lib/test/test_capi/test_opt.py
+++ b/Lib/test/test_capi/test_opt.py
@@ -2201,8 +2201,7 @@ def test_call_builtin_o(self):
def testfunc(n):
x = 0
for _ in range(n):
- my_abs = abs
- y = my_abs(1)
+ y = abs(1)
x += y
return x
@@ -2210,9 +2209,10 @@ def testfunc(n):
self.assertEqual(res, TIER2_THRESHOLD)
self.assertIsNotNone(ex)
uops = get_opnames(ex)
+ pop_tops = [opname for opname in iter_opnames(ex) if opname ==
"_POP_TOP"]
self.assertIn("_CALL_BUILTIN_O", uops)
- self.assertNotIn("_POP_TOP", uops)
self.assertIn("_POP_TOP_NOP", uops)
+ self.assertLessEqual(len(pop_tops), 1)
def test_call_method_descriptor_o(self):
def testfunc(n):
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]