Merge hell

This commit is contained in:
rocky
2021-10-26 06:42:23 -04:00
parent 8aeb0aad8c
commit 5390e3b838
5 changed files with 13 additions and 14 deletions

View File

@@ -75,9 +75,7 @@ def main_bin():
(3, 4), (3, 5), (3, 6),
(3, 7), (3, 8), (3, 9), (3, 10)
)):
print('Error: %s requires Python 2.4-3.10' % program,
file=sys.stderr)
>>>>>>> python-3.3-to-3.5
print('Error: %s requires Python 2.4-3.10' % program)
sys.exit(-1)
do_verify = recurse_dirs = False

View File

@@ -30,7 +30,7 @@ from uncompyle6.semantics.linemap import deparse_code_with_map
from xdis.load import load_module
def _get_outstream(outfile: str):
def _get_outstream(outfile):
dir = os.path.dirname(outfile)
failed_file = outfile + "_failed"
if os.path.exists(failed_file):
@@ -42,7 +42,7 @@ def _get_outstream(outfile: str):
return open(outfile, 'wb')
def decompile(
bytecode_version: str,
bytecode_version,
co,
out=None,
showasm=None,
@@ -155,7 +155,7 @@ def decompile(
raise pysource.SourceWalkerError(str(e))
def compile_file(source_path: str) -> str:
def compile_file(source_path):
if source_path.endswith(".py"):
basename = source_path[:-3]
else:
@@ -236,10 +236,10 @@ def decompile_file(
# FIXME: combine into an options parameter
def main(
in_base: str,
out_base: str,
compiled_files: list,
source_files: list,
in_base,
out_base,
compiled_files,
source_files,
outfile=None,
showasm=None,
showast=False,

View File

@@ -891,9 +891,9 @@ def python_parser(
if __name__ == "__main__":
def parse_test(co):
from uncompyle6 import PYTHON_VERSION, IS_PYPY
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
ast = python_parser(PYTHON_VERSION, co, showasm=True, is_pypy=IS_PYPY)
ast = python_parser(PYTHON_VERSION_TRIPLE[:2], co, showasm=True, is_pypy=IS_PYPY)
print(ast)
return
parse_test(parse_test.func_code)

View File

@@ -593,5 +593,5 @@ if __name__ == "__main__":
co = inspect.currentframe().f_code
# scanner = get_scanner('2.7.13', True)
# scanner = get_scanner(sys.version[:5], False)
scanner = get_scanner(uncompyle6.PYTHON_VERSION, IS_PYPY, True)
scanner = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY, True)
tokens, customize = scanner.ingest(co, {}, show_asm="after")

View File

@@ -88,7 +88,8 @@ class Token: # Python 2.4 can't have empty ()
if opc is None:
try:
from xdis.std import _std_api
except KeyError as e:
except KeyError:
e = sys.exec_info()[1]
print("I don't know about Python version %s yet." % e)
try:
version_tuple = tuple(int(i) for i in str(e)[1:-1].split("."))