You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
BIN
test/bytecode_2.7/11_multi_genexpr.pyc
Normal file
BIN
test/bytecode_2.7/11_multi_genexpr.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.5/11_multi_genexpr.pyc
Normal file
BIN
test/bytecode_3.5/11_multi_genexpr.pyc
Normal file
Binary file not shown.
24
test/simple_source/expression/11_multi_genexpr.py
Normal file
24
test/simple_source/expression/11_multi_genexpr.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Had bug in Python 3.x
|
||||||
|
|
||||||
|
# Should see (Python 2.x and 3.x:
|
||||||
|
# get_iter ::= expr GET_ITER
|
||||||
|
# expr ::= get_iter
|
||||||
|
# _for ::= GET_ITER FOR_ITER
|
||||||
|
# designator ::= STORE_FAST
|
||||||
|
# expr ::= LOAD_FAST
|
||||||
|
# yield ::= expr YIELD_VALUE
|
||||||
|
# expr ::= yield
|
||||||
|
# gen_comp_body ::= expr YIELD_VALUE POP_TOP
|
||||||
|
# comp_body ::= gen_comp_body
|
||||||
|
# comp_iter ::= comp_body
|
||||||
|
# comp_for ::= expr _for designator comp_iter JUMP_BACK
|
||||||
|
# comp_iter ::= comp_for
|
||||||
|
# genexpr_func ::= LOAD_FAST FOR_ITER designator comp_iter JUMP_BACK
|
||||||
|
|
||||||
|
def multi_genexpr(blog_posts):
|
||||||
|
|
||||||
|
return (
|
||||||
|
entry
|
||||||
|
for blog_post in blog_posts
|
||||||
|
for entry in blog_post.entry_set
|
||||||
|
)
|
@@ -288,6 +288,8 @@ class PythonParser(GenericASTBuilder):
|
|||||||
|
|
||||||
comp_if ::= expr jmp_false comp_iter
|
comp_if ::= expr jmp_false comp_iter
|
||||||
comp_ifnot ::= expr jmp_true comp_iter
|
comp_ifnot ::= expr jmp_true comp_iter
|
||||||
|
|
||||||
|
comp_for ::= expr _for designator comp_iter JUMP_BACK
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_expr(self, args):
|
def p_expr(self, args):
|
||||||
|
@@ -36,12 +36,6 @@ class Python2Parser(PythonParser):
|
|||||||
list_for ::= expr _for designator list_iter JUMP_BACK
|
list_for ::= expr _for designator list_iter JUMP_BACK
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_setcomp2(self, args):
|
|
||||||
'''
|
|
||||||
# This is different in python3 - should it be?
|
|
||||||
comp_for ::= expr _for designator comp_iter JUMP_BACK
|
|
||||||
'''
|
|
||||||
|
|
||||||
def p_print(self, args):
|
def p_print(self, args):
|
||||||
'''
|
'''
|
||||||
stmt ::= print_items_stmt
|
stmt ::= print_items_stmt
|
||||||
|
@@ -58,10 +58,9 @@ class Python3Parser(PythonParser):
|
|||||||
|
|
||||||
def p_setcomp3(self, args):
|
def p_setcomp3(self, args):
|
||||||
"""
|
"""
|
||||||
# This is different in Python 2 - should it be?
|
# Does this also happen in Python 2?
|
||||||
comp_for ::= expr _for designator comp_iter JUMP_ABSOLUTE
|
# If so, adjust p_setcomp in parser.py
|
||||||
|
comp_for ::= expr _for designator comp_iter JUMP_BACK
|
||||||
# See also common Python p_setcomp
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_grammar(self, args):
|
def p_grammar(self, args):
|
||||||
|
Reference in New Issue
Block a user