You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Merge pull request #16 from rocky/multi-gen--bug-3.5
Fix 3.x generator bug...
This commit is contained in:
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_ifnot ::= expr jmp_true comp_iter
|
||||
|
||||
comp_for ::= expr _for designator comp_iter JUMP_BACK
|
||||
"""
|
||||
|
||||
def p_expr(self, args):
|
||||
|
@@ -36,12 +36,6 @@ class Python2Parser(PythonParser):
|
||||
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):
|
||||
'''
|
||||
stmt ::= print_items_stmt
|
||||
|
@@ -56,14 +56,6 @@ class Python3Parser(PythonParser):
|
||||
# See also common Python p_list_comprehension
|
||||
"""
|
||||
|
||||
def p_setcomp3(self, args):
|
||||
"""
|
||||
# This is different in Python 2 - should it be?
|
||||
comp_for ::= expr _for designator comp_iter JUMP_ABSOLUTE
|
||||
|
||||
# See also common Python p_setcomp
|
||||
"""
|
||||
|
||||
def p_grammar(self, args):
|
||||
'''
|
||||
sstmt ::= stmt
|
||||
|
Reference in New Issue
Block a user