Author torsten
Recipients belopolsky, ncoghlan, pitrou, rhettinger, torsten
Date 2011-12-10.23:34:19
SpamBayes Score 7.84914e-08
Marked as misclassified No
Message-id <1323560060.38.0.705380761049.issue11822@psf.upfronthosting.co.za>
In-reply-to
Content
I offer the attached patch as a starting point to fulfill this feature request.

The patch changes the output to insert the disassembly of local code objects on the referencing line.

As that made the output unreadable to me, I added indentation for the nested code (by 4 spaces, hoping that nobody will nest code 10 levels deep :-)

This results in the following output for the original example:

>>> from dis import dis
>>> dis('[x**2 for x in range(3)]')
  1           0 LOAD_CONST               0 (<code object <listcomp> at 0x7f24a67dde40, file "<dis>", line 1>) 
  1               0 BUILD_LIST               0 
                  3 LOAD_FAST                0 (.0) 
            >>    6 FOR_ITER                16 (to 25) 
                  9 STORE_FAST               1 (x) 
                 12 LOAD_FAST                1 (x) 
                 15 LOAD_CONST               0 (2) 
                 18 BINARY_POWER         
                 19 LIST_APPEND              2 
                 22 JUMP_ABSOLUTE            6 
            >>   25 RETURN_VALUE         
              3 LOAD_CONST               1 ('<listcomp>') 
              6 MAKE_FUNCTION            0 
              9 LOAD_NAME                0 (range) 
             12 LOAD_CONST               2 (3) 
             15 CALL_FUNCTION            1 
             18 GET_ITER             
             19 CALL_FUNCTION            1 
             22 RETURN_VALUE
History
Date User Action Args
2011-12-10 23:34:20torstensetrecipients: + torsten, rhettinger, ncoghlan, belopolsky, pitrou
2011-12-10 23:34:20torstensetmessageid: <1323560060.38.0.705380761049.issue11822@psf.upfronthosting.co.za>
2011-12-10 23:34:19torstenlinkissue11822 messages
2011-12-10 23:34:19torstencreate