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 5c2af69925
3 changed files with 18 additions and 6 deletions

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