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

Method _iadd

crates/vm/src/vm/vm_ops.rs:444–459  ·  view source on GitHub ↗
(&self, a: &PyObject, b: &PyObject)

Source from the content-addressed store, hash-verified

442 }
443
444 pub fn _iadd(&self, a: &PyObject, b: &PyObject) -> PyResult {
445 let result = self.binary_iop1(a, b, PyNumberBinaryOp::InplaceAdd, PyNumberBinaryOp::Add)?;
446 if !result.is(&self.ctx.not_implemented) {
447 return Ok(result);
448 }
449 // Check inplace_concat or concat slot directly, matching PyNumber_InPlaceAdd behavior
450 let seq = a.sequence_unchecked();
451 let slots = seq.slots();
452 if let Some(f) = slots.inplace_concat.load().or_else(|| slots.concat.load()) {
453 let result = f(seq, b, self)?;
454 if !result.is(&self.ctx.not_implemented) {
455 return Ok(result);
456 }
457 }
458 Err(self.new_unsupported_bin_op_error(a, b, "+="))
459 }
460
461 pub fn _mul(&self, a: &PyObject, b: &PyObject) -> PyResult {
462 let result = self.binary_op1(a, b, PyNumberBinaryOp::Multiply)?;

Callers 5

execute_bin_opMethod · 0.80
inplace_concatMethod · 0.80
iaddFunction · 0.80
iconcatFunction · 0.80
nextMethod · 0.80

Calls 8

binary_iop1Method · 0.80
isMethod · 0.80
sequence_uncheckedMethod · 0.80
fFunction · 0.50
ErrClass · 0.50
slotsMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected