You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
lambda *args with kwargs in 3.4 and 3.5
This commit is contained in:
BIN
test/bytecode_3.4_run/04_lambda_star_default.pyc
Normal file
BIN
test/bytecode_3.4_run/04_lambda_star_default.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.5_run/04_lambda_star_default.pyc
Normal file
BIN
test/bytecode_3.5_run/04_lambda_star_default.pyc
Normal file
Binary file not shown.
@@ -602,7 +602,7 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.version <= 3.3
|
self.version <= 3.5
|
||||||
and len(node) > 2
|
and len(node) > 2
|
||||||
and (have_kwargs or node[lc_index].kind != "load_closure")
|
and (have_kwargs or node[lc_index].kind != "load_closure")
|
||||||
):
|
):
|
||||||
@@ -727,12 +727,11 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
|
|
||||||
paramnames = list(scanner_code.co_varnames[:argc])
|
paramnames = list(scanner_code.co_varnames[:argc])
|
||||||
if kwonlyargcount > 0:
|
if kwonlyargcount > 0:
|
||||||
if self.version <= 3.3 and is_lambda:
|
if self.version <= 3.5 and is_lambda:
|
||||||
kwargs = []
|
kwargs = []
|
||||||
for i in range(kwonlyargcount):
|
for i in range(kwonlyargcount):
|
||||||
paramnames.append(scanner_code.co_varnames[argc+i])
|
paramnames.append(scanner_code.co_varnames[argc+i])
|
||||||
pass
|
pass
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
kwargs = list(scanner_code.co_varnames[argc : argc + kwonlyargcount])
|
kwargs = list(scanner_code.co_varnames[argc : argc + kwonlyargcount])
|
||||||
|
|
||||||
@@ -794,7 +793,7 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
else:
|
else:
|
||||||
params.append("*%s" % star_arg)
|
params.append("*%s" % star_arg)
|
||||||
pass
|
pass
|
||||||
if is_lambda and self.version <= 3.3:
|
if is_lambda and self.version <= 3.5:
|
||||||
params.reverse()
|
params.reverse()
|
||||||
else:
|
else:
|
||||||
params.append("*%s" % code.co_varnames[argc])
|
params.append("*%s" % code.co_varnames[argc])
|
||||||
@@ -856,7 +855,13 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
|
|||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if kw_nodes != "kwarg":
|
# FIXME: something weird is going on and the below
|
||||||
|
# might not be right. On 3.4 kw_nodes != "kwarg"
|
||||||
|
# because of some sort of type mismatch. I think
|
||||||
|
# the test is for versions earlier than 3.3
|
||||||
|
# on 3.5 if we have "kwarg" we still want to do this.
|
||||||
|
# Perhaps we should be testing that kw_nodes is iterable?
|
||||||
|
if kw_nodes != "kwarg" or self.version == 3.5:
|
||||||
other_kw = [c == None for c in kw_args]
|
other_kw = [c == None for c in kw_args]
|
||||||
|
|
||||||
for i, flag in enumerate(other_kw):
|
for i, flag in enumerate(other_kw):
|
||||||
|
Reference in New Issue
Block a user