(self, other: &PyObject, vm: &VirtualMachine)
| 153 | } |
| 154 | |
| 155 | pub fn concat(self, other: &PyObject, vm: &VirtualMachine) -> PyResult { |
| 156 | if let Some(f) = self.slots().concat.load() { |
| 157 | return f(self, other, vm); |
| 158 | } |
| 159 | |
| 160 | // if both arguments appear to be sequences, try fallback to __add__ |
| 161 | if self.check() && other.sequence_unchecked().check() { |
| 162 | let ret = vm.binary_op1(self.obj, other, PyNumberBinaryOp::Add)?; |
| 163 | if let PyArithmeticValue::Implemented(ret) = PyArithmeticValue::from_object(vm, ret) { |
| 164 | return Ok(ret); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | Err(vm.new_type_error(format!( |
| 169 | "'{}' object can't be concatenated", |
| 170 | self.obj.class() |
| 171 | ))) |
| 172 | } |
| 173 | |
| 174 | pub fn repeat(self, n: isize, vm: &VirtualMachine) -> PyResult { |
| 175 | if let Some(f) = self.slots().repeat.load() { |
nothing calls this directly
no test coverage detected