File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,8 @@ def p_30(self, args):
74
74
# Need to keep LOAD_FAST as index 1
75
75
set_comp_header ::= BUILD_SET_0 DUP_TOP STORE_FAST
76
76
set_comp_func ::= set_comp_header
77
- LOAD_FAST FOR_ITER store comp_iter
78
- JUMP_BACK POP_TOP JUMP_BACK RETURN_VALUE RETURN_LAST
77
+ LOAD_ARG FOR_ITER store comp_iter
78
+ JUMP_BACK COME_FROM POP_TOP JUMP_BACK RETURN_VALUE RETURN_LAST
79
79
80
80
list_comp_header ::= BUILD_LIST_0 DUP_TOP STORE_FAST
81
81
list_comp ::= list_comp_header
Original file line number Diff line number Diff line change @@ -465,7 +465,7 @@ def comprehension_walk_newer(
465
465
self .write (": " )
466
466
self .preorder (n [1 ])
467
467
else :
468
- if self .version == (3 , 0 ):
468
+ if self .version == (3 , 0 ) and len ( n ) > 1 :
469
469
body = n [1 ]
470
470
else :
471
471
body = n [0 ]
Original file line number Diff line number Diff line change @@ -1093,7 +1093,12 @@ def n_set_comp(self, node):
1093
1093
self .write ("{" )
1094
1094
if node [0 ] in ["LOAD_SETCOMP" , "LOAD_DICTCOMP" ]:
1095
1095
if self .version == (3 , 0 ):
1096
- iter_index = 6
1096
+ if len (node ) >= 6 :
1097
+ iter_index = 6
1098
+ else :
1099
+ assert node [1 ].kind .startswith ("MAKE_FUNCTION" )
1100
+ iter_index = 2
1101
+ pass
1097
1102
else :
1098
1103
iter_index = 1
1099
1104
self .comprehension_walk_newer (node , iter_index = iter_index , code_index = 0 )
You can’t perform that action at this time.
0 commit comments