You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Python 2.5-2.6 generator bug
Adjust for variable position of list iteration node in a genexpr node
This commit is contained in:
BIN
test/bytecode_2.6/05_generator.pyc
Normal file
BIN
test/bytecode_2.6/05_generator.pyc
Normal file
Binary file not shown.
9
test/simple_source/bug26/05_generator.py
Normal file
9
test/simple_source/bug26/05_generator.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# From Python 2.6 ast.py
|
||||
# Bug was finding the last iteration expression in generator-expression handling
|
||||
#
|
||||
fields = (1, 2)
|
||||
rv = '%s(%s' % (__name__.__class__.__name__, ', '.join(
|
||||
('%s=%s' % field for field in fields)
|
||||
if __file__ else
|
||||
(b for a, b in fields)
|
||||
))
|
@@ -1247,7 +1247,9 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
self.write(' for ')
|
||||
self.preorder(ast[iter_index-1])
|
||||
self.write(' in ')
|
||||
self.preorder(node[-3])
|
||||
iter_expr = node[2] if node[2] == 'expr' else node[-3]
|
||||
assert iter_expr == 'expr'
|
||||
self.preorder(iter_expr)
|
||||
self.preorder(ast[iter_index])
|
||||
self.prec = p
|
||||
|
||||
|
Reference in New Issue
Block a user