read .pyc
Closed this issue · 3 comments
Majingnan36 commented
Does it support reading .pyc files? Get all bytecode instructions in .pyc by similar to Bytecode.from_code(code_obj)
MatthieuDartiailh commented
No currently bytecode only operate on code objects.
I never tried to open a pyc and unmarshall it, but you could try that and grab the module code object to use with bytecode.
P403n1x87 commented
Would something like this work for you?
from pkgutil import read_code
with open("path/to.pyc", "rb") as f
bc = Bytecode.from_code(read_code(f))
Majingnan36 commented
Thanks for your answers, it's very helpful for me