MCPcopy Index your code
hub / github.com/RustPython/RustPython / for_iter_jump_on_exhausted

Method for_iter_jump_on_exhausted

crates/vm/src/frame.rs:8947–8962  ·  view source on GitHub ↗

Handle iterator exhaustion in specialized FOR_ITER handlers. Skips END_FOR if present at target and jumps.

(&mut self, target: bytecode::Label)

Source from the content-addressed store, hash-verified

8945 /// Handle iterator exhaustion in specialized FOR_ITER handlers.
8946 /// Skips END_FOR if present at target and jumps.
8947 fn for_iter_jump_on_exhausted(&mut self, target: bytecode::Label) {
8948 let target_idx = target.as_usize();
8949 let jump_target = if let Some(unit) = self.code.instructions.get(target_idx) {
8950 if matches!(
8951 unit.op,
8952 bytecode::Instruction::EndFor | bytecode::Instruction::InstrumentedEndFor
8953 ) {
8954 bytecode::Label::from_u32(target.as_u32() + 1)
8955 } else {
8956 target
8957 }
8958 } else {
8959 target
8960 };
8961 self.jump(jump_target);
8962 }
8963
8964 fn specialize_load_global(
8965 &mut self,

Callers 1

execute_instructionMethod · 0.80

Calls 3

as_u32Method · 0.80
jumpMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected