Where to find pyc bytecode structure information

191 Views Asked by At

I'm trying to make a decoder for .pyc files, and need to figure out how the structure is.

I have found several suggestions but they all use the marshal module to load the code and then dis to disassemble it.

I have found a few simple explanations of the general structure which led me to build a simple decompiler. The best post was this: How to create a code object in python?

However, I need more direct information to be able to decode all the information. Such as what markers indicate what, what flags are used and how to decode them and type decoding.

So does anyone know where I can find any documentation on how to decode a pyc file? and/or its general structure?

Regards

1

There are 1 best solutions below

0
Ephreal On

I found that I can look in the marshal.c file for the current version of python3. This gives me the different flags to look for in the bytecode, and in turn, helps with the decoding.

Regards