101101)
102102from mypyc .primitives .exc_ops import (
103103 error_catch_op ,
104+ error_clear_op ,
104105 exc_matches_op ,
105106 get_exc_info_op ,
106107 get_exc_value_op ,
107108 keep_propagating_op ,
108- err_occurred_op ,
109109 no_err_occurred_op ,
110110 propagate_if_error_op ,
111111 raise_exception_op ,
112112 reraise_exception_op ,
113113 restore_exc_info_op ,
114- error_clear_op ,
115114)
116- from mypyc .primitives .generic_ops import iter_op , next_op , next_raw_op , py_delattr_op
115+ from mypyc .primitives .generic_ops import iter_op , next_raw_op , py_delattr_op
117116from mypyc .primitives .misc_ops import (
118117 check_stop_op ,
119118 coro_op ,
120- debug_print_op ,
121119 import_from_many_op ,
122120 import_many_op ,
123121 import_op ,
@@ -993,7 +991,10 @@ def _transform_with_contextmanager(
993991
994992 # mgrv = ctx.__wrapped__(*args, **kwargs)
995993 wrapped_call = mypy .nodes .CallExpr (
996- mypy .nodes .MemberExpr (expr .callee , "__wrapped__" ), expr .args , expr .arg_kinds , expr .arg_names
994+ mypy .nodes .MemberExpr (expr .callee , "__wrapped__" ),
995+ expr .args ,
996+ expr .arg_kinds ,
997+ expr .arg_names ,
997998 )
998999 gen = builder .accept (wrapped_call )
9991000
@@ -1007,7 +1008,9 @@ def _transform_with_contextmanager(
10071008 builder .add (Branch (mgr_target , runtime_block , main_block , Branch .IS_ERROR ))
10081009
10091010 builder .activate_block (runtime_block )
1010- builder .add (RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't yield" , line ))
1011+ builder .add (
1012+ RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't yield" , line )
1013+ )
10111014 builder .add (Unreachable ())
10121015
10131016 builder .activate_block (main_block )
@@ -1046,7 +1049,11 @@ def except_body() -> None:
10461049 builder .builder .pop_error_handler ()
10471050
10481051 builder .activate_block (no_error_block )
1049- builder .add (RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't stop after throw()" , line ))
1052+ builder .add (
1053+ RaiseStandardError (
1054+ RaiseStandardError .RUNTIME_ERROR , "generator didn't stop after throw()" , line
1055+ )
1056+ )
10501057 builder .add (Unreachable ())
10511058
10521059 builder .activate_block (error_block )
@@ -1085,20 +1092,16 @@ def else_body() -> None:
10851092 builder .activate_block (close_block )
10861093 # TODO: this isn't exactly the right order
10871094 builder .py_call (builder .py_get_attr (gen , "close" , line ), [], line )
1088- builder .add (RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't stop" , line ))
1095+ builder .add (
1096+ RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't stop" , line )
1097+ )
10891098 builder .add (Unreachable ())
10901099
10911100 builder .activate_block (stop_block )
10921101 # TODO: should check for StopIteration
10931102 builder .call_c (error_clear_op , [], - 1 )
10941103
1095- transform_try_except (
1096- builder ,
1097- try_body ,
1098- handlers ,
1099- else_body ,
1100- line ,
1101- )
1104+ transform_try_except (builder , try_body , handlers , else_body , line )
11021105
11031106
11041107def transform_with_stmt (builder : IRBuilder , o : WithStmt ) -> None :
0 commit comments