Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support high version python to decompile low version pyc #453

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JANlittle
Copy link

Uncompyle6 uses the current Python interpreter version as the default .pyc version, which prevents Python 3.11 from working, even if the .pyc version is 3.8 or lower. I made some small modifications to specify the version of .pyc when generating tokens, which may be helpful. Due to time constraints, I only tested a few pyc file. Sorry for that. :(
Also, it maybe need to change xdis/std.py:

from uncompyle6 import PYC_version
_std_api = make_std_api(PYC_version)

@rocky
Copy link
Owner

rocky commented Apr 18, 2023

I don't understand. I can build uncompyle6 from 3.9 and when I pass it a bytecode file from 3.0 it works.

$ ./bin/uncompyle6 test/bytecode_3.0/00_import.pyc 
# uncompyle6 version 3.9.1.dev0
# Python bytecode version base 3.0 (3131)
# Decompiled from: Python 3.9.16 (main, Dec 13 2022, 19:28:33) 
# [GCC 11.3.0]
# Embedded file name: simple_source/stmts/00_import.py
# Compiled at: 2019-07-10 15:49:35
import sys
from os import path
from os import *
import time as time1, os as os1, http.client as httpclient
if len(__file__) == 0:
    import a.b.c as d, stuff0.stuff1.stuff2.stuff3 as stuff3
# okay decompiling test/bytecode_3.0/00_import.pyc

So what exactly is it that you want to do?

It feels like the only thing this may do is allow one not to have to specify a version somewhere, and I don't see this that important.

@rocky rocky force-pushed the master branch 7 times, most recently from b7eae4f to 29edaae Compare March 16, 2024 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants