(&self, a: &PyObject)
| 531 | } |
| 532 | |
| 533 | pub fn _invert(&self, a: &PyObject) -> PyResult { |
| 534 | const STR: &str = "Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. \ |
| 535 | This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. \ |
| 536 | Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int."; |
| 537 | if a.fast_isinstance(self.ctx.types.bool_type) { |
| 538 | _warnings::warn( |
| 539 | self.ctx.exceptions.deprecation_warning, |
| 540 | STR.to_owned(), |
| 541 | 1, |
| 542 | self, |
| 543 | )?; |
| 544 | } |
| 545 | self.get_special_method(a, identifier!(self, __invert__))? |
| 546 | .ok_or_else(|| self.new_unsupported_unary_error(a, "unary ~"))? |
| 547 | .invoke((), self) |
| 548 | } |
| 549 | |
| 550 | // PyObject_Format |
| 551 | pub fn format(&self, obj: &PyObject, format_spec: PyStrRef) -> PyResult<PyStrRef> { |
no test coverage detected