- 
                Notifications
    You must be signed in to change notification settings 
- Fork 345
Description
When I try to decompile .pyc files generated by python-exe-unpacker, I got the following error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/xdis/load.py", line 209, in load_module_from_file_object
    co = marshal.loads(bytecode)
ValueError: bad marshal data (unknown type code)
And those .pyc are also treated invalid by Python interpreter:
RuntimeError: Bad code object in .pyc file
After spending two hours figuring out what's wrong, I think it is valuable to note them down here even if this project seemingly has ended:
I suppose the problem resides around
https://github.com/countercept/python-exe-unpacker/blob/6c88e9b28cb40615b680cefdb5f47ce4cab17833/pyinstxtractor.py#L322
where the appended header (incl. magic number, timestamp, size, etc) seems to mismatch with the .pyc format used by some newer Python versions (in my case 3.7).
To make uncompyle6 work well with malformed .pyc, dirty patch /usr/local/lib/python3.7/site-packages/xdis/load.py to make sure marshal.loads data starting from exactly 12th byte of original .pyc (e.g. utilizing BytesIO so that the fp can be read twice) helps.