You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Fix EXTENDED_ARG for long lists, sets, maps
This commit is contained in:
1123
test/simple_source/expression/06_huge_list.py
Normal file
1123
test/simple_source/expression/06_huge_list.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -627,6 +627,12 @@ class Python3Parser(PythonParser):
|
|||||||
self.custom_build_class_rule(opname, i, token, tokens, customize)
|
self.custom_build_class_rule(opname, i, token, tokens, customize)
|
||||||
elif opname_base in ('BUILD_LIST', 'BUILD_TUPLE', 'BUILD_SET'):
|
elif opname_base in ('BUILD_LIST', 'BUILD_TUPLE', 'BUILD_SET'):
|
||||||
v = token.attr
|
v = token.attr
|
||||||
|
if self.version >= 3.6:
|
||||||
|
extended_arg = 1 << 8
|
||||||
|
else:
|
||||||
|
extended_arg = 1 << 16
|
||||||
|
if v >= extended_arg:
|
||||||
|
opname = "EXTENDED_ARG %s" % opname
|
||||||
rule = ('build_list ::= ' + 'expr1024 ' * int(v//1024) +
|
rule = ('build_list ::= ' + 'expr1024 ' * int(v//1024) +
|
||||||
'expr32 ' * int((v//32) % 32) +
|
'expr32 ' * int((v//32) % 32) +
|
||||||
'expr ' * (v % 32) + opname)
|
'expr ' * (v % 32) + opname)
|
||||||
|
@@ -1646,7 +1646,7 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
sep = ''
|
sep = ''
|
||||||
|
|
||||||
for elem in flat_elems:
|
for elem in flat_elems:
|
||||||
if elem == 'ROT_THREE':
|
if elem in ('ROT_THREE', 'EXTENDED_ARG'):
|
||||||
continue
|
continue
|
||||||
assert elem == 'expr'
|
assert elem == 'expr'
|
||||||
line_number = self.line_number
|
line_number = self.line_number
|
||||||
|
Reference in New Issue
Block a user