You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Python 2.1-2.6 bug in list comprehension
This commit is contained in:
BIN
test/bytecode_2.6/06_list_comprehension_x2_if.pyc
Normal file
BIN
test/bytecode_2.6/06_list_comprehension_x2_if.pyc
Normal file
Binary file not shown.
11
test/simple_source/bug22/06_list_comprehension_x2_if.py
Normal file
11
test/simple_source/bug22/06_list_comprehension_x2_if.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# listComprehensions.py -- source test pattern for list comprehensions
|
||||||
|
#
|
||||||
|
# This simple program is part of the decompyle test suite.
|
||||||
|
#
|
||||||
|
# decompyle is a Python byte-code decompiler
|
||||||
|
# See http://www.goebel-consult.de/decompyle/ for further information
|
||||||
|
|
||||||
|
print [i*j for i in range(4)
|
||||||
|
if i == 2
|
||||||
|
for j in range(7)
|
||||||
|
if (i+i % 2) == 0 ]
|
@@ -14,6 +14,10 @@ class Python22Parser(Python23Parser):
|
|||||||
def p_misc22(self, args):
|
def p_misc22(self, args):
|
||||||
'''
|
'''
|
||||||
_for ::= LOAD_CONST FOR_LOOP
|
_for ::= LOAD_CONST FOR_LOOP
|
||||||
|
list_iter ::= list_if JUMP_FORWARD
|
||||||
|
COME_FROM POP_TOP COME_FROM
|
||||||
|
list_for ::= expr _for designator list_iter CONTINUE JUMP_FORWARD
|
||||||
|
COME_FROM POP_TOP COME_FROM
|
||||||
'''
|
'''
|
||||||
|
|
||||||
class Python22ParserSingle(Python23Parser, PythonParserSingle):
|
class Python22ParserSingle(Python23Parser, PythonParserSingle):
|
||||||
|
@@ -170,6 +170,7 @@ class Python26Parser(Python2Parser):
|
|||||||
list_for ::= expr _for designator list_iter jb_cont
|
list_for ::= expr _for designator list_iter jb_cont
|
||||||
|
|
||||||
list_iter ::= list_if JUMP_BACK
|
list_iter ::= list_if JUMP_BACK
|
||||||
|
list_iter ::= list_if JUMP_BACK COME_FROM POP_TOP
|
||||||
list_compr ::= BUILD_LIST_0 DUP_TOP
|
list_compr ::= BUILD_LIST_0 DUP_TOP
|
||||||
designator list_iter del_stmt
|
designator list_iter del_stmt
|
||||||
list_compr ::= BUILD_LIST_0 DUP_TOP
|
list_compr ::= BUILD_LIST_0 DUP_TOP
|
||||||
|
Reference in New Issue
Block a user