You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
3.6 MAKE_FUNCTION workarounds
Still wrong, but points to diretions for improvements
This commit is contained in:
BIN
test/bytecode_3.6/05_call_star_kw.pyc
Normal file
BIN
test/bytecode_3.6/05_call_star_kw.pyc
Normal file
Binary file not shown.
3
test/simple_source/bug36/05_call_star_kw.py
Normal file
3
test/simple_source/bug36/05_call_star_kw.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# From 3.6 base64.py. Bug was handling *, and keyword args
|
||||
def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'):
|
||||
return
|
@@ -217,6 +217,7 @@ def main(in_base, out_base, files, codes, outfile=None,
|
||||
sys.stdout.write("\n")
|
||||
sys.stderr.write("\n# file %s\n# %s\n" % (infile, e))
|
||||
failed_files += 1
|
||||
tot_files += 1
|
||||
except KeyboardInterrupt:
|
||||
if outfile:
|
||||
outstream.close()
|
||||
|
@@ -619,12 +619,34 @@ def make_function3(self, node, is_lambda, nested=1, codeNode=None):
|
||||
ends_in_comma = False
|
||||
break
|
||||
elif self.version >= 3.6:
|
||||
d = node[1]
|
||||
if d == 'expr':
|
||||
d = d[0]
|
||||
assert d == 'dict'
|
||||
defaults = [self.traverse(n, indent='') for n in d[:-2]]
|
||||
names = eval(self.traverse(d[-2]))
|
||||
# argc = node[-1].attr
|
||||
# co = node[-3].attr
|
||||
# argcount = co.co_argcount
|
||||
# kwonlyargcount = co.co_kwonlyargcount
|
||||
|
||||
free_tup = annotate_dict = kw_dict = default_tup = None
|
||||
index = 0
|
||||
# FIXME: this is woefully wrong
|
||||
if argc & 8:
|
||||
free_tup = node[index]
|
||||
index += 1
|
||||
if argc & 4:
|
||||
kw_dict = node[1]
|
||||
index += 1
|
||||
if argc & 2:
|
||||
kw_dict = node[index]
|
||||
index += 1
|
||||
if argc & 1:
|
||||
kw_dict = node[index]
|
||||
|
||||
if kw_dict == 'expr':
|
||||
kw_dict = kw_dict[0]
|
||||
|
||||
# FIXME: handle free_tup, annotatate_dict, and default_tup
|
||||
if kw_dict:
|
||||
assert kw_dict == 'dict'
|
||||
defaults = [self.traverse(n, indent='') for n in kw_dict[:-2]]
|
||||
names = eval(self.traverse(kw_dict[-2]))
|
||||
assert len(defaults) == len(names)
|
||||
sep = ''
|
||||
# FIXME: possibly handle line breaks
|
||||
|
Reference in New Issue
Block a user