[issue11822] Improve disassembly to show embedded code objects

STINNER Victor report at bugs.python.org
Mon Jun 12 05:14:26 EDT 2017


STINNER Victor added the comment:

Thanks Serhiy, it works and I like the result :-)

>>> def f():
...  def g():
...   return 3
...  return g
... 

>>> import dis; dis.dis(f)
  2           0 LOAD_CONST               1 (<code object g at 0x7f16ab2e2c40, file "<stdin>", line 2>)
              2 LOAD_CONST               2 ('f.<locals>.g')
              4 MAKE_FUNCTION            0
              6 STORE_FAST               0 (g)

  4           8 LOAD_FAST                0 (g)
             10 RETURN_VALUE

Disassembly of <code object g at 0x7f16ab2e2c40, file "<stdin>", line 2>:
  3           0 LOAD_CONST               1 (3)
              2 RETURN_VALUE

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11822>
_______________________________________


More information about the Python-bugs-list mailing list