]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix test
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Tue, 28 Oct 2025 10:39:33 +0000 (10:39 +0000)
committerKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Tue, 28 Oct 2025 10:39:33 +0000 (10:39 +0000)
Lib/test/test_capi/test_opt.py

index 265bb2941399be6ba911b27cd4376a10158edc01..10b308c0aafab5e6d22a733f1b0678703320316e 100644 (file)
@@ -1241,8 +1241,14 @@ class TestUopsOptimization(unittest.TestCase):
             pass
 
         res, ex = self._run_with_optimizer(thing, Foo())
-        # Cleaned up by the invalidation.
-        self.assertIsNone(ex)
+        opnames = list(iter_opnames(ex))
+        self.assertIsNotNone(ex)
+        self.assertEqual(res, TIER2_THRESHOLD * 6 + 1)
+        call = opnames.index("_CALL_BUILTIN_FAST")
+        load_attr_top = opnames.index("_POP_TOP_LOAD_CONST_INLINE_BORROW", 0, call)
+        load_attr_bottom = opnames.index("_POP_TOP_LOAD_CONST_INLINE_BORROW", call)
+        self.assertEqual(opnames[:load_attr_top].count("_GUARD_TYPE_VERSION"), 1)
+        self.assertEqual(opnames[call:load_attr_bottom].count("_CHECK_VALIDITY"), 2)
 
     def test_guard_type_version_removed_escaping(self):