Skip to content

Commit c5b0c90

Browse files
authored
gh-115999: Update test_opcache to test with nested method (gh-128166)
gh-115999: Update test_opcace to test with nested method
1 parent 180d417 commit c5b0c90

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Lib/test/test_opcache.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def assert_races_do_not_crash(
606606
for writer in writers:
607607
writer.join()
608608

609-
@requires_specialization
609+
@requires_specialization_ft
610610
def test_binary_subscr_getitem(self):
611611
def get_items():
612612
class C:
@@ -1242,14 +1242,6 @@ def f(o, n):
12421242
f(test_obj, 1)
12431243
self.assertEqual(test_obj.b, 0)
12441244

1245-
# gh-127274: BINARY_SUBSCR_GETITEM will only cache __getitem__ methods that
1246-
# are deferred. We only defer functions defined at the top-level.
1247-
class CGetItem:
1248-
def __init__(self, val):
1249-
self.val = val
1250-
def __getitem__(self, item):
1251-
return self.val
1252-
12531245

12541246
class TestSpecializer(TestBase):
12551247

@@ -1592,7 +1584,13 @@ def binary_subscr_str_int():
15921584
self.assert_no_opcode(binary_subscr_str_int, "BINARY_SUBSCR")
15931585

15941586
def binary_subscr_getitems():
1595-
items = [CGetItem(i) for i in range(100)]
1587+
class C:
1588+
def __init__(self, val):
1589+
self.val = val
1590+
def __getitem__(self, item):
1591+
return self.val
1592+
1593+
items = [C(i) for i in range(100)]
15961594
for i in range(100):
15971595
self.assertEqual(items[i][i], i)
15981596

0 commit comments

Comments
 (0)