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 wrapped_call .line = line
9991000 gen = builder .accept (wrapped_call )
@@ -1008,7 +1009,9 @@ def _transform_with_contextmanager(
10081009 builder .add (Branch (mgr_target , runtime_block , main_block , Branch .IS_ERROR ))
10091010
10101011 builder .activate_block (runtime_block )
1011- builder .add (RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't yield" , line ))
1012+ builder .add (
1013+ RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't yield" , line )
1014+ )
10121015 builder .add (Unreachable ())
10131016
10141017 builder .activate_block (main_block )
@@ -1047,7 +1050,11 @@ def except_body() -> None:
10471050 builder .builder .pop_error_handler ()
10481051
10491052 builder .activate_block (no_error_block )
1050- builder .add (RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't stop after throw()" , line ))
1053+ builder .add (
1054+ RaiseStandardError (
1055+ RaiseStandardError .RUNTIME_ERROR , "generator didn't stop after throw()" , line
1056+ )
1057+ )
10511058 builder .add (Unreachable ())
10521059
10531060 builder .activate_block (error_block )
@@ -1086,20 +1093,16 @@ def else_body() -> None:
10861093 builder .activate_block (close_block )
10871094 # TODO: this isn't exactly the right order
10881095 builder .py_call (builder .py_get_attr (gen , "close" , line ), [], line )
1089- builder .add (RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't stop" , line ))
1096+ builder .add (
1097+ RaiseStandardError (RaiseStandardError .RUNTIME_ERROR , "generator didn't stop" , line )
1098+ )
10901099 builder .add (Unreachable ())
10911100
10921101 builder .activate_block (stop_block )
10931102 # TODO: should check for StopIteration
10941103 builder .call_c (error_clear_op , [], - 1 )
10951104
1096- transform_try_except (
1097- builder ,
1098- try_body ,
1099- handlers ,
1100- else_body ,
1101- line ,
1102- )
1105+ transform_try_except (builder , try_body , handlers , else_body , line )
11031106
11041107
11051108def transform_with_stmt (builder : IRBuilder , o : WithStmt ) -> None :
0 commit comments