Method
__str__
(zelf: &Py<Self>, vm: &VirtualMachine)
Source from the content-addressed store, hash-verified
| 1483 | |
| 1484 | #[pymethod] |
| 1485 | fn __str__(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyStrRef> { |
| 1486 | if zelf.class().is(vm.ctx.types.str_type) { |
| 1487 | // Already exact str, just return a reference |
| 1488 | Ok(zelf.to_owned()) |
| 1489 | } else { |
| 1490 | // Subclass, create a new exact str |
| 1491 | Ok(PyStr::from(zelf.data.clone()).into_ref(&vm.ctx)) |
| 1492 | } |
| 1493 | } |
| 1494 | } |
| 1495 | |
| 1496 | impl PyRef<PyStr> { |
Callers
nothing calls this directly
Tested by
no test coverage detected