This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Shannon
Recipients Guido.van.Rossum, Mark.Shannon, Yonatan Goldschmidt, chris.jerdonek, corona10, erlendaasland, gvanrossum, hauntsaninja, rhettinger, serhiy.storchaka
Date 2021-04-29.13:53:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619704430.69.0.926614673722.issue40222@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-04-29 13:53:50Mark.Shannonsetrecipients: + Mark.Shannon, gvanrossum, rhettinger, chris.jerdonek, serhiy.storchaka, Guido.van.Rossum, corona10, erlendaasland, Yonatan Goldschmidt, hauntsaninja
2021-04-29 13:53:50Mark.Shannonsetmessageid: <1619704430.69.0.926614673722.issue40222@roundup.psfhosted.org>
2021-04-29 13:53:50Mark.Shannonlinkissue40222 messages
2021-04-29 13:53:50Mark.Shannoncreate