Loosen check to allow running from 2.4-3.10

We still only can *decompile* 2.4-3.8
This commit is contained in:
rocky
2021-10-26 06:08:17 -04:00
parent ea26084e6d
commit d0ca7b0363
3 changed files with 19 additions and 8 deletions

View File

@@ -74,9 +74,9 @@ def main_bin():
if not (sys.version_info[0:2] in ((2, 6), (2, 7), (3, 0),
(3, 1), (3, 2), (3, 3),
(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)
sys.exit(-1)

View File

@@ -19,13 +19,11 @@
Common uncompyle6 parser routines.
"""
from __future__ import print_function
import sys
from xdis import iscode, py_str2float
from spark_parser import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
from uncompyle6.show import maybe_show_asm
from xdis import iscode
class ParserError(Exception):

View File

@@ -28,7 +28,14 @@ import sys
from uncompyle6.scanners.tok import Token
from xdis.version_info import IS_PYPY, PYTHON3, version_tuple_to_str
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.
# 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("self.opc = %s" % v_str)
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
@@ -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()
)
else:
raise RuntimeError("Unsupported Python version %s" % version)
raise RuntimeError(
"Unsupported Python version, %s, for decompilation"
% version_tuple_to_str(version)
)
return scanner