File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1170,7 +1170,6 @@ def _catch_ast(ctx: CompilerContext, form: llist.List) -> ast.ExceptHandler:
1170
1170
1171
1171
def _finally_ast (ctx : CompilerContext , form : llist .List ) -> ASTStream :
1172
1172
"""Generate Python AST nodes for `finally` forms."""
1173
- assert isinstance (form , llist .List )
1174
1173
assert form .first == _FINALLY
1175
1174
assert len (form ) >= 2
1176
1175
@@ -1224,8 +1223,12 @@ def _try_ast(ctx: CompilerContext, form: llist.List) -> ASTStream:
1224
1223
if len (finallys ) not in [0 , 1 ]:
1225
1224
raise CompilerException ("Only one finally clause may be provided in a try/catch block" ) from None
1226
1225
1227
- catch_exprs : List [ast .AST ] = seq (clauses .get ("catch" , [])).map (lambda f : _catch_ast (ctx , f )).to_list ()
1228
- final_exprs : List [ast .AST ] = seq (finallys ).flat_map (lambda f : _finally_ast (ctx , f )).to_list ()
1226
+ catch_exprs : List [ast .AST ] = seq (clauses .get ("catch" , [])) \
1227
+ .map (lambda f : _catch_ast (ctx , llist .list (f ))) \
1228
+ .to_list ()
1229
+ final_exprs : List [ast .AST ] = seq (finallys ) \
1230
+ .flat_map (lambda f : _finally_ast (ctx , llist .list (f ))) \
1231
+ .to_list ()
1229
1232
1230
1233
# Start building up the try/except block that will be inserted
1231
1234
# into a function to expressionize it
You can’t perform that action at this time.
0 commit comments