You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Correct bugs in Python 3.2 source generation
This commit is contained in:
@@ -492,11 +492,17 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
p = self.prec
|
||||
self.prec = 27
|
||||
if hasattr(node[code_index], 'attr'):
|
||||
# Python 2.5+ (and earlier?) does this
|
||||
code = node[code_index].attr
|
||||
elif hasattr(node[1][1], 'attr'):
|
||||
code = node[1][1].attr
|
||||
else:
|
||||
assert False
|
||||
if len(node[1]) > 1 and hasattr(node[1][1], 'attr'):
|
||||
# Python 3.3+ does this
|
||||
code = node[1][1].attr
|
||||
elif hasattr(node[1][0], 'attr'):
|
||||
# Python 3.2 does this
|
||||
code = node[1][0].attr
|
||||
else:
|
||||
assert False, "Can't find code for comprehension"
|
||||
|
||||
assert iscode(code)
|
||||
code = Code(code, self.scanner, self.currentclass)
|
||||
@@ -1020,6 +1026,10 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
# Python 3.0..3.4 style key/value list in mapexpr
|
||||
kv_node = node[1]
|
||||
l = list(kv_node)
|
||||
if len(l) > 0 and l[0].type == 'kv3':
|
||||
# Python 3.2 does this
|
||||
kv_node = node[1][0]
|
||||
l = list(kv_node)
|
||||
i = 0
|
||||
while i < len(l):
|
||||
l[1].parent = kv_node
|
||||
|
Reference in New Issue
Block a user