Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2020-05-18 23:25:53 -04:00
34 changed files with 836 additions and 426 deletions

View File

@@ -16,8 +16,7 @@
All the crazy things we have to do to handle Python functions in 3.0-3.5 or so.
The saga of changes before and after is in other files.
"""
from xdis import iscode, code_has_star_arg, code_has_star_star_arg
from xdis.util import CO_GENERATOR
from xdis import iscode, code_has_star_arg, code_has_star_star_arg, CO_GENERATOR
from uncompyle6.scanner import Code
from uncompyle6.parsers.treenode import SyntaxTree
from uncompyle6.semantics.parser_error import ParserError
@@ -33,6 +32,7 @@ from uncompyle6.show import maybe_show_tree_param_default
# FIXME: DRY the below code...
def make_function3_annotate(
self, node, is_lambda, nested=1, code_node=None, annotate_last=-1
):
@@ -265,8 +265,8 @@ def make_function3_annotate(
self.write("\n" + indent)
line_number = self.line_number
self.write(" -> ")
if 'return' in annotate_dict:
self.write(annotate_dict['return'])
if "return" in annotate_dict:
self.write(annotate_dict["return"])
else:
# value, string = annotate_args['return']
# if string:
@@ -423,9 +423,7 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
lc_index = -3
pass
if (len(node) > 2
and (have_kwargs or node[lc_index].kind != "load_closure")
):
if len(node) > 2 and (have_kwargs or node[lc_index].kind != "load_closure"):
# Find the index in "node" where the first default
# parameter value is located. Note this is in contrast to
@@ -483,7 +481,7 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
if is_lambda:
kwargs = []
for i in range(kwonlyargcount):
paramnames.append(scanner_code.co_varnames[argc+i])
paramnames.append(scanner_code.co_varnames[argc + i])
pass
else:
kwargs = list(scanner_code.co_varnames[argc : argc + kwonlyargcount])
@@ -686,5 +684,5 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
if need_bogus_yield:
self.template_engine(("%|if False:\n%+%|yield None%-",), node)
scanner_code._tokens = None # save memory
scanner_code._tokens = None # save memory
scanner_code._customize = None # save memory