You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Loosen check to allow running from 2.4-3.10
We still only can *decompile* 2.4-3.8
This commit is contained in:
@@ -74,9 +74,9 @@ def main_bin():
|
|||||||
if not (sys.version_info[0:2] in ((2, 6), (2, 7), (3, 0),
|
if not (sys.version_info[0:2] in ((2, 6), (2, 7), (3, 0),
|
||||||
(3, 1), (3, 2), (3, 3),
|
(3, 1), (3, 2), (3, 3),
|
||||||
(3, 4), (3, 5), (3, 6),
|
(3, 4), (3, 5), (3, 6),
|
||||||
(3, 7), (3, 8)
|
(3, 7), (3, 8), (3, 9), (3, 10)
|
||||||
)):
|
)):
|
||||||
print('Error: %s requires Python 2.6-3.8' % program,
|
print('Error: %s requires Python 2.4-3.10' % program,
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
@@ -23,7 +23,6 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from xdis import iscode, py_str2float
|
|
||||||
from spark_parser import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
from spark_parser import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
||||||
from uncompyle6.show import maybe_show_asm
|
from uncompyle6.show import maybe_show_asm
|
||||||
|
|
||||||
|
@@ -28,7 +28,14 @@ import sys
|
|||||||
from uncompyle6.scanners.tok import Token
|
from uncompyle6.scanners.tok import Token
|
||||||
from xdis.version_info import IS_PYPY, PYTHON3, version_tuple_to_str
|
from xdis.version_info import IS_PYPY, PYTHON3, version_tuple_to_str
|
||||||
import xdis
|
import xdis
|
||||||
from xdis import Bytecode, canonic_python_version, code2num, instruction_size, extended_arg_val, next_offset
|
from xdis import (
|
||||||
|
Bytecode,
|
||||||
|
canonic_python_version,
|
||||||
|
code2num,
|
||||||
|
instruction_size,
|
||||||
|
extended_arg_val,
|
||||||
|
next_offset,
|
||||||
|
)
|
||||||
|
|
||||||
# The byte code versions we support.
|
# The byte code versions we support.
|
||||||
# Note: these all have to be tuples of 2 ints
|
# Note: these all have to be tuples of 2 ints
|
||||||
@@ -111,7 +118,10 @@ class Scanner(object):
|
|||||||
exec("from xdis.opcodes import %s" % v_str)
|
exec("from xdis.opcodes import %s" % v_str)
|
||||||
exec("self.opc = %s" % v_str)
|
exec("self.opc = %s" % v_str)
|
||||||
else:
|
else:
|
||||||
raise TypeError("%s is not a Python version I know about" % version_tuple_to_str(version))
|
raise TypeError(
|
||||||
|
"%s is not a Python version I know about"
|
||||||
|
% version_tuple_to_str(version)
|
||||||
|
)
|
||||||
|
|
||||||
self.opname = self.opc.opname
|
self.opname = self.opc.opname
|
||||||
|
|
||||||
@@ -566,7 +576,10 @@ def get_scanner(version, is_pypy=False, show_asm=None):
|
|||||||
"scan.Scanner%s(show_asm=show_asm)" % v_str, locals(), globals()
|
"scan.Scanner%s(show_asm=show_asm)" % v_str, locals(), globals()
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Unsupported Python version %s" % version)
|
raise RuntimeError(
|
||||||
|
"Unsupported Python version, %s, for decompilation"
|
||||||
|
% version_tuple_to_str(version)
|
||||||
|
)
|
||||||
return scanner
|
return scanner
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user