You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Bug in detecting 3.3 default value in lambda
This commit is contained in:
BIN
test/bytecode_3.3/02_pos_args.pyc
Normal file
BIN
test/bytecode_3.3/02_pos_args.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.3/03_func_params.pyc
Normal file
BIN
test/bytecode_3.3/03_func_params.pyc
Normal file
Binary file not shown.
3
test/simple_source/bug33/02_pos_args.py
Normal file
3
test/simple_source/bug33/02_pos_args.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# From Python 3.3.6 hmac.py
|
||||
# Problem was getting wrong placement of positional args
|
||||
digest_cons = lambda d=b'': 5
|
6
test/simple_source/bug33/03_func_params.py
Normal file
6
test/simple_source/bug33/03_func_params.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# Bug from Python 3.3 codecs.py
|
||||
# Bug is in 3.3 handling of this complicated parameter list
|
||||
def __new__(cls, encode, decode, streamreader=None, streamwriter=None,
|
||||
incrementalencoder=None, incrementaldecoder=None, name=None,
|
||||
*, _is_text_encoding=None):
|
||||
return
|
@@ -1609,16 +1609,16 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
|
||||
args_node = node[-1]
|
||||
if isinstance(args_node.attr, tuple):
|
||||
if self.version == 3.3:
|
||||
if self.version <= 3.3 and len(node) > 2 and node[-3] != 'LOAD_LAMBDA':
|
||||
# positional args are after kwargs
|
||||
defparams = node[1:args_node.attr[0]+1]
|
||||
else:
|
||||
# positional args are before kwargs
|
||||
defparams = node[:args_node.attr[0]]
|
||||
pos_aargs, kw_args, annotate_args = args_node.attr
|
||||
pos_args, kw_args, annotate_argc = args_node.attr
|
||||
else:
|
||||
defparams = node[:args_node.attr]
|
||||
kw_args, annotate_args = (0, 0)
|
||||
kw_args, annotate_argc = (0, 0)
|
||||
pass
|
||||
|
||||
if self.version > 3.0 and isLambda and iscode(node[-3].attr):
|
||||
|
@@ -395,7 +395,7 @@ def make_function3(self, node, isLambda, nested=1, codeNode=None):
|
||||
|
||||
args_node = node[-1]
|
||||
if isinstance(args_node.attr, tuple):
|
||||
if self.version <= 3.3:
|
||||
if self.version <= 3.3 and len(node) > 2 and node[-3] != 'LOAD_LAMBDA':
|
||||
# positional args are after kwargs
|
||||
defparams = node[1:args_node.attr[0]+1]
|
||||
else:
|
||||
|
Reference in New Issue
Block a user