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

Method inplace_concat

crates/vm/src/protocol/sequence.rs:190–210  ·  view source on GitHub ↗
(self, other: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

188 }
189
190 pub fn inplace_concat(self, other: &PyObject, vm: &VirtualMachine) -> PyResult {
191 if let Some(f) = self.slots().inplace_concat.load() {
192 return f(self, other, vm);
193 }
194 if let Some(f) = self.slots().concat.load() {
195 return f(self, other, vm);
196 }
197
198 // if both arguments appear to be sequences, try fallback to __iadd__
199 if self.check() && other.sequence_unchecked().check() {
200 let ret = vm._iadd(self.obj, other)?;
201 if let PyArithmeticValue::Implemented(ret) = PyArithmeticValue::from_object(vm, ret) {
202 return Ok(ret);
203 }
204 }
205
206 Err(vm.new_type_error(format!(
207 "'{}' object can't be concatenated",
208 self.obj.class()
209 )))
210 }
211
212 pub fn inplace_repeat(self, n: isize, vm: &VirtualMachine) -> PyResult {
213 if let Some(f) = self.slots().inplace_repeat.load() {

Callers

nothing calls this directly

Calls 7

sequence_uncheckedMethod · 0.80
_iaddMethod · 0.80
fFunction · 0.50
ErrClass · 0.50
loadMethod · 0.45
slotsMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected