I need to create a call graph of python function and then modify bytecode of some functions.
I started to play with disassembly and found that function is make by MAKE_FUNCTION opcode and the code object somehow passed to it
32 96 LOAD_CONST 25 ((None, None, True, 'off', None, False))
98 LOAD_CONST 15 (<code object foobar at 0x7fc46bff6d20, file "foo.py", line 25>)
100 LOAD_CONST 16 ('foo')
102 MAKE_FUNCTION 1
104 STORE_NAME 15 ('fun')
Okay, I found roots of the callgraph in this file, but what to do next? How do I actually get this code object?