[issue11822] Improve disassembly to show embedded code objects

Stéphane Wirtel report at bugs.python.org
Fri Nov 6 16:16:34 EST 2015


Stéphane Wirtel added the comment:

Hi all,

For this feature, I have an other output:

stephane at sg1 /tmp> python3 dump_bytecode.py
<module>
--------
  3           0 LOAD_BUILD_CLASS
              1 LOAD_CONST               0 (<code object User at 0x10b830270, file "<show>", line 3>)
              4 LOAD_CONST               1 ('User')
              7 MAKE_FUNCTION            0
             10 LOAD_CONST               1 ('User')
             13 CALL_FUNCTION            2 (2 positional, 0 keyword pair)
             16 STORE_NAME               0 (User)

  8          19 LOAD_NAME                0 (User)
             22 LOAD_CONST               2 ('user')
             25 LOAD_CONST               3 ('password')
             28 CALL_FUNCTION            2 (2 positional, 0 keyword pair)
             31 STORE_NAME               1 (user)
             34 LOAD_CONST               4 (None)
             37 RETURN_VALUE

<module>.User
-------------
  3           0 LOAD_NAME                0 (__name__)
              3 STORE_NAME               1 (__module__)
              6 LOAD_CONST               0 ('User')
              9 STORE_NAME               2 (__qualname__)

  4          12 LOAD_CONST               1 (<code object __init__ at 0x10b824270, file "<show>", line 4>)
             15 LOAD_CONST               2 ('User.__init__')
             18 MAKE_FUNCTION            0
             21 STORE_NAME               3 (__init__)
             24 LOAD_CONST               3 (None)
             27 RETURN_VALUE

<module>.User.__init__
----------------------
  5           0 LOAD_FAST                1 (email)
              3 LOAD_FAST                0 (self)
              6 STORE_ATTR               0 (email)

  6           9 LOAD_FAST                2 (password)
             12 LOAD_FAST                0 (self)
             15 STORE_ATTR               1 (password)
             18 LOAD_CONST               0 (None)
             21 RETURN_VALUE

----------
nosy: +matrixise
versions: +Python 3.6 -Python 3.5

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


More information about the Python-bugs-list mailing list