From 7bfac269263af23dbf6180554627a7c2f0d1c7a9 Mon Sep 17 00:00:00 2001 From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:39:33 +0000 Subject: [PATCH] fix test --- Lib/test/test_capi/test_opt.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_capi/test_opt.py b/Lib/test/test_capi/test_opt.py index 265bb2941399..10b308c0aafa 100644 --- a/Lib/test/test_capi/test_opt.py +++ b/Lib/test/test_capi/test_opt.py @@ -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): -- 2.47.3