mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
GH-96793: Change FOR_ITER
to not pop the iterator on exhaustion. (GH-96801)
Change FOR_ITER to have the same stack effect regardless of whether it branches or not. Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
This commit is contained in:
parent
e60892f9db
commit
22863df7ca
14 changed files with 277 additions and 247 deletions
|
@ -40,7 +40,7 @@ class OpcodeTests(unittest.TestCase):
|
|||
self.assertEqual(stack_effect(JUMP_IF_TRUE_OR_POP, 0, jump=False), -1)
|
||||
FOR_ITER = dis.opmap['FOR_ITER']
|
||||
self.assertEqual(stack_effect(FOR_ITER, 0), 1)
|
||||
self.assertEqual(stack_effect(FOR_ITER, 0, jump=True), -1)
|
||||
self.assertEqual(stack_effect(FOR_ITER, 0, jump=True), 1)
|
||||
self.assertEqual(stack_effect(FOR_ITER, 0, jump=False), 1)
|
||||
JUMP_FORWARD = dis.opmap['JUMP_FORWARD']
|
||||
self.assertEqual(stack_effect(JUMP_FORWARD, 0), 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue