Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: I started on Antoine's PR and work on different approach (https://github.com/serhiy-storchaka/cpython/pull/1) which don't duplicate the code for continue/break/return. Instead it uses some kind of subroutines. END_FINALLY expects the one of three cases:
1. NULL (or None). Normal execution thread in try/finally. Continue from the instruction following END_FINALLY. 2. An integer. This is an address of returning. Continue from the specified address. 3. An exception (6 items). Raises the specified exception. WITH_CLEANUP_FINISH behaves similarly. The statements continue/break/return insert the instruction CALL_FINALLY which pushes the address of the following instruction on the stack and jumps to the start of the finally (or with cleanup) block. There can be several CALL_FINALLY instructions if you need to execute several finally blocks. At the jump instruction is inserted for continue and break, and RETURN_VALUE for return. Currently I'm trying to simplify the code. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue17611> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com