3

I have a .pyc file with no corresponding Python source code. I want to see the disassembly of the module using dis. I can import my module just fine with

import dis
import foo

But to call dis.dis on it, I can't use the module object. I need the corresponding code object which backs foo. How do I create it? It seems that the compile builtin can compile strings, classes, methods, and functions, but not files or modules.

How do I generate this code object given what I have?

1 Answer 1

4

See http://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.