[Python-Dev] The purpose of SETUP_LOOP, BREAK_LOOP, CONTINUE_LOOP

Eugene Toder eltoder at gmail.com
Sat Mar 12 14:25:04 CET 2011


> There are also "with" blocks :-) (which use separate opcodes, although
> they are similar in principle to try/finally blocks)

IIUC they use separate opcode, but the same block type (SETUP_FINALLY).

> There may be complications with nested try/finally blocks. You either
> need to generate separate bytecode for when the "finally" clause is
> entered following a given continue/break (so as to hardcode the jump
> offset at the end of the clause), or save the jump offsets somewhere on
> a stack for each finally clause to pop, IMO.

Right, I'm not suggesting to remove all blocks, only SETUP_LOOP
blocks. Do you see the problem in that case?

Eugene


More information about the Python-Dev mailing list