You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 16:59:52 +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.stdout.write("\n")
|
||||||
sys.stderr.write("\n# file %s\n# %s\n" % (infile, e))
|
sys.stderr.write("\n# file %s\n# %s\n" % (infile, e))
|
||||||
failed_files += 1
|
failed_files += 1
|
||||||
|
tot_files += 1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
if outfile:
|
if outfile:
|
||||||
outstream.close()
|
outstream.close()
|
||||||
|
@@ -619,12 +619,34 @@ def make_function3(self, node, is_lambda, nested=1, codeNode=None):
|
|||||||
ends_in_comma = False
|
ends_in_comma = False
|
||||||
break
|
break
|
||||||
elif self.version >= 3.6:
|
elif self.version >= 3.6:
|
||||||
d = node[1]
|
# argc = node[-1].attr
|
||||||
if d == 'expr':
|
# co = node[-3].attr
|
||||||
d = d[0]
|
# argcount = co.co_argcount
|
||||||
assert d == 'dict'
|
# kwonlyargcount = co.co_kwonlyargcount
|
||||||
defaults = [self.traverse(n, indent='') for n in d[:-2]]
|
|
||||||
names = eval(self.traverse(d[-2]))
|
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)
|
assert len(defaults) == len(names)
|
||||||
sep = ''
|
sep = ''
|
||||||
# FIXME: possibly handle line breaks
|
# FIXME: possibly handle line breaks
|
||||||
|
Reference in New Issue
Block a user