(&self, a: &PyObject, b: &PyObject)
| 482 | } |
| 483 | |
| 484 | pub fn _imul(&self, a: &PyObject, b: &PyObject) -> PyResult { |
| 485 | let result = self.binary_iop1( |
| 486 | a, |
| 487 | b, |
| 488 | PyNumberBinaryOp::InplaceMultiply, |
| 489 | PyNumberBinaryOp::Multiply, |
| 490 | )?; |
| 491 | if !result.is(&self.ctx.not_implemented) { |
| 492 | return Ok(result); |
| 493 | } |
| 494 | if let Ok(seq_a) = a.try_sequence(self) { |
| 495 | let n = b |
| 496 | .try_index(self)? |
| 497 | .as_bigint() |
| 498 | .to_isize() |
| 499 | .ok_or_else(|| self.new_overflow_error("repeated bytes are too long"))?; |
| 500 | return seq_a.inplace_repeat(n, self); |
| 501 | } else if let Ok(seq_b) = b.try_sequence(self) { |
| 502 | let n = a |
| 503 | .try_index(self)? |
| 504 | .as_bigint() |
| 505 | .to_isize() |
| 506 | .ok_or_else(|| self.new_overflow_error("repeated bytes are too long"))?; |
| 507 | /* Note that the right hand operand should not be |
| 508 | * mutated in this case so inplace_repeat is not |
| 509 | * used. */ |
| 510 | return seq_b.repeat(n, self); |
| 511 | } |
| 512 | Err(self.new_unsupported_bin_op_error(a, b, "*=")) |
| 513 | } |
| 514 | |
| 515 | pub fn _abs(&self, a: &PyObject) -> PyResult<PyObjectRef> { |
| 516 | self.get_special_method(a, identifier!(self, __abs__))? |
no test coverage detected