fork download
  1. import dis
  2. import sys
  3.  
  4. dis.dis(sys._getframe().f_code)
  5.  
  6. def dec(): pass
  7.  
  8. @dec
  9. class Foo: pass
  10.  
  11. @dec
  12. class Bar(Foo): pass
Runtime error #stdin #stdout #stderr 0.01s 29768KB
stdin
Standard input is empty
stdout
  1           0 LOAD_CONST               0 (0)
              3 LOAD_CONST               1 (None)
              6 IMPORT_NAME              0 (dis)
              9 STORE_NAME               0 (dis)

  2          12 LOAD_CONST               0 (0)
             15 LOAD_CONST               1 (None)
             18 IMPORT_NAME              1 (sys)
             21 STORE_NAME               1 (sys)

  4          24 LOAD_NAME                0 (dis)
             27 LOAD_ATTR                0 (dis)
             30 LOAD_NAME                1 (sys)
             33 LOAD_ATTR                2 (_getframe)
             36 CALL_FUNCTION            0 (0 positional, 0 keyword pair)
             39 LOAD_ATTR                3 (f_code)
             42 CALL_FUNCTION            1 (1 positional, 0 keyword pair)
             45 POP_TOP

  6          46 LOAD_CONST               2 (<code object dec at 0x2b2a653e09c0, file "./prog.py", line 6>)
             49 LOAD_CONST               3 ('dec')
             52 MAKE_FUNCTION            0
             55 STORE_NAME               4 (dec)

  8          58 LOAD_NAME                4 (dec)
             61 LOAD_BUILD_CLASS
             62 LOAD_CONST               4 (<code object Foo at 0x2b2a65422810, file "./prog.py", line 8>)
             65 LOAD_CONST               5 ('Foo')
             68 MAKE_FUNCTION            0
             71 LOAD_CONST               5 ('Foo')
             74 CALL_FUNCTION            2 (2 positional, 0 keyword pair)
             77 CALL_FUNCTION            1 (1 positional, 0 keyword pair)
             80 STORE_NAME               5 (Foo)

 11          83 LOAD_NAME                4 (dec)
             86 LOAD_BUILD_CLASS
             87 LOAD_CONST               6 (<code object Bar at 0x2b2a654a0f60, file "./prog.py", line 11>)
             90 LOAD_CONST               7 ('Bar')
             93 MAKE_FUNCTION            0
             96 LOAD_CONST               7 ('Bar')

 12          99 LOAD_NAME                5 (Foo)
            102 CALL_FUNCTION            3 (3 positional, 0 keyword pair)
            105 CALL_FUNCTION            1 (1 positional, 0 keyword pair)
            108 STORE_NAME               6 (Bar)
            111 LOAD_CONST               1 (None)
            114 RETURN_VALUE
stderr
Traceback (most recent call last):
  File "./prog.py", line 8, in <module>
TypeError: dec() takes 0 positional arguments but 1 was given