How do I disassemble a generated comprehension?

For example, I am trying to debug the following:

>>> dis.dis('{**{} for x in [{1:2}]}')
  1           0 LOAD_CONST               0 (<code object <dictcomp> at
0x10160b7c0, file "<dis>", line 1>)
              3 LOAD_CONST               1 ('<dictcomp>')
              6 MAKE_FUNCTION            0
              9 LOAD_CONST               2 (2)
             12 LOAD_CONST               3 (1)
             15 BUILD_MAP                1
             18 BUILD_LIST               1
             21 GET_ITER
             22 CALL_FUNCTION            1 (1 positional, 0 keyword pair)
             25 RETURN_VALUE

(This requires the new patch in issue 2292.)

The code here looks fine to me, so I need to look into the code object
<dictcomp>.  How do I do that?

Thanks,

Neil
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to