1

I try reverse python bytecode (Content in a .pyc file). I do not want to decompile the code, just understand the Python bytecode :)

The LOAD_NAME statement, pushes the value associated with co_names (tuple of names of local variables...) [namei] onto the stack. (How can I check these values contained in co_names?)

n

4

You can use the marshal module to load the code object.

Now, suppose you want to find out what does LOAD_NAME 1 loads on the evaluation stack.

import marshal

co = marshal.load(...)
print co.co_names[1]

# Or if you want to print the entire co_names
print co.co_names

Refer to the dis module for further reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.