mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
GH-118095: Handle RETURN_GENERATOR
in tier 2 (GH-118180)
This commit is contained in:
parent
10bb90ed49
commit
f180b31e76
16 changed files with 143 additions and 81 deletions
|
@ -1286,5 +1286,17 @@ class TestUopsOptimization(unittest.TestCase):
|
|||
self.assertEqual(res, 32 * 32)
|
||||
self.assertIsNone(ex)
|
||||
|
||||
def test_return_generator(self):
|
||||
def gen():
|
||||
yield None
|
||||
def testfunc(n):
|
||||
for i in range(n):
|
||||
gen()
|
||||
return i
|
||||
res, ex = self._run_with_optimizer(testfunc, 20)
|
||||
self.assertEqual(res, 19)
|
||||
self.assertIsNotNone(ex)
|
||||
self.assertIn("_RETURN_GENERATOR", get_opnames(ex))
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue