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

Function else_body

mypyc/irbuild/statement.py:1380–1398  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1378 builder.nonlocal_control[-1].gen_break(builder, line)
1379
1380 def else_body() -> None:
1381 # Do a next() or a .send(). It will return NULL on exception
1382 # but it won't automatically propagate.
1383 _y = builder.call_c(
1384 send_op, [builder.read(iter_reg, line), builder.read(received_reg, line)], line
1385 )
1386 ok, stop = BasicBlock(), BasicBlock()
1387 builder.add(Branch(_y, stop, ok, Branch.IS_ERROR))
1388
1389 # Everything's fine. Yield it.
1390 builder.activate_block(ok)
1391 builder.assign(to_yield_reg, _y, line)
1392 builder.nonlocal_control[-1].gen_continue(builder, line)
1393
1394 # Try extracting a return value from a StopIteration and return it.
1395 # If it wasn't, this rereaises the exception.
1396 builder.activate_block(stop)
1397 builder.assign(result, builder.call_c(check_stop_op, [], line), line)
1398 builder.nonlocal_control[-1].gen_break(builder, line)
1399
1400 builder.push_loop_stack(loop_block, done_block)
1401 transform_try_except(builder, try_body, [(None, None, except_body)], else_body, line)

Callers 1

transform_try_exceptFunction · 0.85

Calls 9

BasicBlockClass · 0.90
BranchClass · 0.90
call_cMethod · 0.45
readMethod · 0.45
addMethod · 0.45
activate_blockMethod · 0.45
assignMethod · 0.45
gen_continueMethod · 0.45
gen_breakMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…