(number: ArgIndex, vm: &VirtualMachine)
| 916 | |
| 917 | #[pyfunction] |
| 918 | fn oct(number: ArgIndex, vm: &VirtualMachine) -> PyResult { |
| 919 | let number = number.into_int_ref(); |
| 920 | let n = number.as_bigint(); |
| 921 | let s = if n.is_negative() { |
| 922 | format!("-0o{:o}", n.abs()) |
| 923 | } else { |
| 924 | format!("0o{n:o}") |
| 925 | }; |
| 926 | |
| 927 | Ok(vm.ctx.new_str(s).into()) |
| 928 | } |
| 929 | |
| 930 | #[pyfunction] |
| 931 | fn ord(string: Either<ArgBytesLike, PyStrRef>, vm: &VirtualMachine) -> PyResult<u32> { |