Skip to content

Commit 7bfac26

Browse files
fix test
1 parent 1d3aed1 commit 7bfac26

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,8 +1241,14 @@ class Bar:
12411241
pass
12421242

12431243
res, ex = self._run_with_optimizer(thing, Foo())
1244-
# Cleaned up by the invalidation.
1245-
self.assertIsNone(ex)
1244+
opnames = list(iter_opnames(ex))
1245+
self.assertIsNotNone(ex)
1246+
self.assertEqual(res, TIER2_THRESHOLD * 6 + 1)
1247+
call = opnames.index("_CALL_BUILTIN_FAST")
1248+
load_attr_top = opnames.index("_POP_TOP_LOAD_CONST_INLINE_BORROW", 0, call)
1249+
load_attr_bottom = opnames.index("_POP_TOP_LOAD_CONST_INLINE_BORROW", call)
1250+
self.assertEqual(opnames[:load_attr_top].count("_GUARD_TYPE_VERSION"), 1)
1251+
self.assertEqual(opnames[call:load_attr_bottom].count("_CHECK_VALIDITY"), 2)
12461252

12471253
def test_guard_type_version_removed_escaping(self):
12481254

0 commit comments

Comments
 (0)