Mark Shannon <[email protected]> added the comment:
I've played around with a few formats, and what I've ended up with is this:
1. Use the >> marker for for exception targets, as well as normal branch
targets.
2. Add a text version of the exception handler table at the end of the
disassembly.
This has all the information, without too much visual clutter.
The function `f` above looks like this:
>>> dis.dis(f)
2 0 NOP
3 2 LOAD_CONST 1 (1)
4 LOAD_CONST 2 (0)
6 BINARY_TRUE_DIVIDE
8 POP_TOP
10 NOP
12 LOAD_CONST 0 (None)
14 RETURN_VALUE
>> 16 NOP
18 PUSH_EXC_INFO
4 20 POP_TOP
22 POP_TOP
24 POP_TOP
5 26 NOP
28 POP_EXCEPT
30 LOAD_CONST 3 ('fail')
32 RETURN_VALUE
>> 34 POP_EXCEPT_AND_RERAISE
ExceptionTable:
2 to 8 -> 16 (depth 0)
18 to 24 -> 34 (depth 3) lasti
The 'lasti' field indicates that the offset of the last instruction is pushed
to the stack, which is needed for cleanup-then-reraise code.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40222>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com