summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2024-12-23 17:08:34 (GMT)
committerGitHub <noreply@github.com>2024-12-23 17:08:34 (GMT)
commitc5b0c90b62f1a10b0742db4bcd17da080d4e9111 (patch)
tree8bcbf0ae88c25be3960fe79e4558411674659f3d /Lib
parent180d417e9f9456defd4c5b53cae678c318287921 (diff)
downloadcpython-c5b0c90b62f1a10b0742db4bcd17da080d4e9111.zip
cpython-c5b0c90b62f1a10b0742db4bcd17da080d4e9111.tar.gz
cpython-c5b0c90b62f1a10b0742db4bcd17da080d4e9111.tar.bz2
gh-115999: Update test_opcache to test with nested method (gh-128166)
gh-115999: Update test_opcace to test with nested method
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_opcache.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/Lib/test/test_opcache.py b/Lib/test/test_opcache.py
index ba111b5..79f452f 100644
--- a/Lib/test/test_opcache.py
+++ b/Lib/test/test_opcache.py
@@ -606,7 +606,7 @@ class TestRacesDoNotCrash(TestBase):
for writer in writers:
writer.join()
- @requires_specialization
+ @requires_specialization_ft
def test_binary_subscr_getitem(self):
def get_items():
class C:
@@ -1242,14 +1242,6 @@ class TestInstanceDict(unittest.TestCase):
f(test_obj, 1)
self.assertEqual(test_obj.b, 0)
-# gh-127274: BINARY_SUBSCR_GETITEM will only cache __getitem__ methods that
-# are deferred. We only defer functions defined at the top-level.
-class CGetItem:
- def __init__(self, val):
- self.val = val
- def __getitem__(self, item):
- return self.val
-
class TestSpecializer(TestBase):
@@ -1592,7 +1584,13 @@ class TestSpecializer(TestBase):
self.assert_no_opcode(binary_subscr_str_int, "BINARY_SUBSCR")
def binary_subscr_getitems():
- items = [CGetItem(i) for i in range(100)]
+ class C:
+ def __init__(self, val):
+ self.val = val
+ def __getitem__(self, item):
+ return self.val
+
+ items = [C(i) for i in range(100)]
for i in range(100):
self.assertEqual(items[i][i], i)