summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_opcache.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_opcache.py')
-rw-r--r--Lib/test/test_opcache.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_opcache.py b/Lib/test/test_opcache.py
index e39b726..57fed5d 100644
--- a/Lib/test/test_opcache.py
+++ b/Lib/test/test_opcache.py
@@ -1,6 +1,29 @@
import unittest
+class TestLoadSuperAttrCache(unittest.TestCase):
+ def test_descriptor_not_double_executed_on_spec_fail(self):
+ calls = []
+ class Descriptor:
+ def __get__(self, instance, owner):
+ calls.append((instance, owner))
+ return lambda: 1
+
+ class C:
+ d = Descriptor()
+
+ class D(C):
+ def f(self):
+ return super().d()
+
+ d = D()
+
+ self.assertEqual(d.f(), 1) # warmup
+ calls.clear()
+ self.assertEqual(d.f(), 1) # try to specialize
+ self.assertEqual(calls, [(d, D)])
+
+
class TestLoadAttrCache(unittest.TestCase):
def test_descriptor_added_after_optimization(self):
class Descriptor: