MCPcopy Index your code
hub / github.com/python/mypy / transform_try_except_stmt

Function transform_try_except_stmt

mypyc/irbuild/statement.py:754–772  ·  view source on GitHub ↗
(builder: IRBuilder, t: TryStmt)

Source from the content-addressed store, hash-verified

752
753
754def transform_try_except_stmt(builder: IRBuilder, t: TryStmt) -> None:
755 def body() -> None:
756 builder.accept(t.body)
757
758 # Work around scoping woes
759 def make_handler(body: Block) -> GenFunc:
760 return lambda: builder.accept(body)
761
762 def make_entry(type: Expression) -> tuple[ValueGenFunc, int]:
763 return (lambda: builder.accept(type), type.line)
764
765 handlers = [
766 (make_entry(type) if type else None, var, make_handler(body))
767 for type, var, body in zip(t.types, t.vars, t.handlers)
768 ]
769
770 _else_body = t.else_body
771 else_body = (lambda: builder.accept(_else_body)) if _else_body else None
772 transform_try_except(builder, body, handlers, else_body, t.line)
773
774
775def try_finally_try(

Callers 2

transform_try_bodyFunction · 0.85
transform_try_stmtFunction · 0.85

Calls 5

make_entryFunction · 0.85
make_handlerFunction · 0.85
zipFunction · 0.85
transform_try_exceptFunction · 0.85
acceptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…