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

Method inplace_repeat

crates/vm/src/protocol/sequence.rs:212–228  ·  view source on GitHub ↗
(self, n: isize, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

210 }
211
212 pub fn inplace_repeat(self, n: isize, vm: &VirtualMachine) -> PyResult {
213 if let Some(f) = self.slots().inplace_repeat.load() {
214 return f(self, n, vm);
215 }
216 if let Some(f) = self.slots().repeat.load() {
217 return f(self, n, vm);
218 }
219
220 if self.check() {
221 let ret = vm._imul(self.obj, &n.to_pyobject(vm))?;
222 if let PyArithmeticValue::Implemented(ret) = PyArithmeticValue::from_object(vm, ret) {
223 return Ok(ret);
224 }
225 }
226
227 Err(vm.new_type_error(format!("'{}' object can't be repeated", self.obj.class())))
228 }
229
230 pub fn get_item(self, i: isize, vm: &VirtualMachine) -> PyResult {
231 if let Some(f) = self.slots().item.load() {

Callers 1

_imulMethod · 0.80

Calls 7

_imulMethod · 0.80
fFunction · 0.50
ErrClass · 0.50
loadMethod · 0.45
slotsMethod · 0.45
checkMethod · 0.45
to_pyobjectMethod · 0.45

Tested by

no test coverage detected