mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-26 22:50:40 +00:00
Remove unreachable code from make_function36.py...
with respect to picking out MAKE_FUNCTION attributes. Fill in runtests.sh exclude lists
This commit is contained in:
parent
dab7915404
commit
5616f56442
@ -32,3 +32,4 @@ SKIP_TESTS=(
|
||||
[test_zipfile64.py]=1 # Runs ok but takes 204 seconds
|
||||
[test_zipimport.py]=1 #
|
||||
)
|
||||
# 335 unit-test files in about 16 minutes
|
||||
|
@ -99,4 +99,4 @@ SKIP_TESTS=(
|
||||
[test_zipimport_support.py]=1
|
||||
[test_zlib.py]=1
|
||||
)
|
||||
# 249 unit-test file in about 7 minutes and 44 seconds
|
||||
# 272 unit-test file in about 15 minutes
|
||||
|
@ -183,4 +183,4 @@ SKIP_TESTS=(
|
||||
[test_zipimport_support.py]=1
|
||||
[test_zlib.py]=1
|
||||
)
|
||||
# 218 unit-test remaining files, Elapsed time about 7 minutes 30 seconds
|
||||
# 233 unit-test files in about 13 minutes
|
||||
|
@ -125,4 +125,4 @@ SKIP_TESTS=(
|
||||
[test_zipfile.py]=1 # it fails on its own
|
||||
[test_zipfile64.py]=1 # Too long to run
|
||||
)
|
||||
# 268 Remaining unit-test files, Elapsed time about 11 minutes
|
||||
# 271 unit-test files in about 14 minutes
|
||||
|
@ -87,79 +87,17 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None):
|
||||
# not to be confused with keyword parameters which may appear after *.
|
||||
args_attr = args_node.attr
|
||||
|
||||
if isinstance(args_attr, tuple) or isinstance(args_attr, list):
|
||||
if len(args_attr) == 3:
|
||||
pos_args, kw_args, annotate_argc = args_attr
|
||||
else:
|
||||
pos_args, kw_args, annotate_argc, closure = args_attr
|
||||
|
||||
i = -4
|
||||
kw_pairs = 0
|
||||
if closure:
|
||||
# FIXME: fill in
|
||||
i -= 1
|
||||
if annotate_argc:
|
||||
# Turn into subroutine and DRY with other use
|
||||
annotate_node = node[i]
|
||||
if annotate_node == "expr":
|
||||
annotate_node = annotate_node[0]
|
||||
annotate_name_node = annotate_node[-1]
|
||||
if annotate_node == "dict" and annotate_name_node.kind.startswith(
|
||||
"BUILD_CONST_KEY_MAP"
|
||||
):
|
||||
types = [
|
||||
self.traverse(n, indent="") for n in annotate_node[:-2]
|
||||
]
|
||||
names = annotate_node[-2].attr
|
||||
l = len(types)
|
||||
assert l == len(names)
|
||||
for i in range(l):
|
||||
annotate_dict[names[i]] = types[i]
|
||||
pass
|
||||
pass
|
||||
i -= 1
|
||||
if kw_args:
|
||||
kw_node = node[i]
|
||||
if kw_node == "expr":
|
||||
kw_node = kw_node[0]
|
||||
if kw_node == "dict":
|
||||
kw_pairs = kw_node[-1].attr
|
||||
|
||||
defparams = []
|
||||
# FIXME: DRY with code below
|
||||
default, kw_args, annotate_argc = args_node.attr[0:3]
|
||||
if default:
|
||||
expr_node = node[0]
|
||||
if node[0] == "pos_arg":
|
||||
expr_node = expr_node[0]
|
||||
assert expr_node == "expr", "expecting mkfunc default node to be an expr"
|
||||
if expr_node[0] == "LOAD_CONST" and isinstance(expr_node[0].attr, tuple):
|
||||
defparams = [repr(a) for a in expr_node[0].attr]
|
||||
elif expr_node[0] in frozenset(("list", "tuple", "dict", "set")):
|
||||
defparams = [self.traverse(n, indent="") for n in expr_node[0][:-1]]
|
||||
else:
|
||||
defparams = []
|
||||
pass
|
||||
if len(args_attr) == 3:
|
||||
pos_args, kw_args, annotate_argc = args_attr
|
||||
else:
|
||||
default, kw_args, annotate, closure = args_node.attr
|
||||
if default:
|
||||
expr_node = node[0]
|
||||
if node[0] == "pos_arg":
|
||||
expr_node = expr_node[0]
|
||||
assert expr_node == "expr", "expecting mkfunc default node to be an expr"
|
||||
if expr_node[0] == "LOAD_CONST" and isinstance(expr_node[0].attr, tuple):
|
||||
defparams = [repr(a) for a in expr_node[0].attr]
|
||||
elif expr_node[0] in frozenset(("list", "tuple", "dict", "set")):
|
||||
defparams = [self.traverse(n, indent="") for n in expr_node[0][:-1]]
|
||||
else:
|
||||
defparams = []
|
||||
pos_args, kw_args, annotate_argc, closure = args_attr
|
||||
|
||||
i = -4
|
||||
kw_pairs = 0
|
||||
if closure:
|
||||
# FIXME: fill in
|
||||
# annotate = node[i]
|
||||
i -= 1
|
||||
|
||||
if annotate_argc:
|
||||
# Turn into subroutine and DRY with other use
|
||||
annotate_node = node[i]
|
||||
@ -169,7 +107,9 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None):
|
||||
if annotate_node == "dict" and annotate_name_node.kind.startswith(
|
||||
"BUILD_CONST_KEY_MAP"
|
||||
):
|
||||
types = [self.traverse(n, indent="") for n in annotate_node[:-2]]
|
||||
types = [
|
||||
self.traverse(n, indent="") for n in annotate_node[:-2]
|
||||
]
|
||||
names = annotate_node[-2].attr
|
||||
l = len(types)
|
||||
assert l == len(names)
|
||||
@ -184,7 +124,22 @@ def make_function36(self, node, is_lambda, nested=1, code_node=None):
|
||||
kw_node = kw_node[0]
|
||||
if kw_node == "dict":
|
||||
kw_pairs = kw_node[-1].attr
|
||||
pass
|
||||
|
||||
defparams = []
|
||||
# FIXME: DRY with code below
|
||||
default, kw_args, annotate_argc = args_node.attr[0:3]
|
||||
if default:
|
||||
expr_node = node[0]
|
||||
if node[0] == "pos_arg":
|
||||
expr_node = expr_node[0]
|
||||
assert expr_node == "expr", "expecting mkfunc default node to be an expr"
|
||||
if expr_node[0] == "LOAD_CONST" and isinstance(expr_node[0].attr, tuple):
|
||||
defparams = [repr(a) for a in expr_node[0].attr]
|
||||
elif expr_node[0] in frozenset(("list", "tuple", "dict", "set")):
|
||||
defparams = [self.traverse(n, indent="") for n in expr_node[0][:-1]]
|
||||
else:
|
||||
defparams = []
|
||||
pass
|
||||
|
||||
if lambda_index and is_lambda and iscode(node[lambda_index].attr):
|
||||
assert node[lambda_index].kind == "LOAD_LAMBDA"
|
||||
|
Loading…
Reference in New Issue
Block a user