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

Function try_finally_entry_blocks

mypyc/irbuild/statement.py:796–824  ·  view source on GitHub ↗
(
    builder: IRBuilder,
    err_handler: BasicBlock,
    return_entry: BasicBlock,
    main_entry: BasicBlock,
    finally_block: BasicBlock,
    ret_reg: Register | AssignmentTarget | None,
)

Source from the content-addressed store, hash-verified

794
795
796def try_finally_entry_blocks(
797 builder: IRBuilder,
798 err_handler: BasicBlock,
799 return_entry: BasicBlock,
800 main_entry: BasicBlock,
801 finally_block: BasicBlock,
802 ret_reg: Register | AssignmentTarget | None,
803) -> Value:
804 line = builder.fn_info.fitem.line
805 old_exc = Register(exc_rtuple, line=line)
806
807 # Entry block for non-exceptional flow
808 builder.activate_block(main_entry)
809 if ret_reg:
810 builder.assign(ret_reg, builder.add(LoadErrorValue(builder.ret_types[-1], line)), line)
811 builder.goto(return_entry)
812
813 builder.activate_block(return_entry)
814 builder.add(Assign(old_exc, builder.add(LoadErrorValue(exc_rtuple, line)), line))
815 builder.goto(finally_block)
816
817 # Entry block for errors
818 builder.activate_block(err_handler)
819 if ret_reg:
820 builder.assign(ret_reg, builder.add(LoadErrorValue(builder.ret_types[-1], line)), line)
821 builder.add(Assign(old_exc, builder.call_c(error_catch_op, [], line), line))
822 builder.goto(finally_block)
823
824 return old_exc
825
826
827def try_finally_body(

Callers 1

Calls 8

RegisterClass · 0.90
LoadErrorValueClass · 0.90
AssignClass · 0.90
activate_blockMethod · 0.45
assignMethod · 0.45
addMethod · 0.45
gotoMethod · 0.45
call_cMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…