(i: PyIntRef, vm: &VirtualMachine)
| 85 | |
| 86 | #[pyfunction] |
| 87 | fn chr(i: PyIntRef, vm: &VirtualMachine) -> PyResult<CodePoint> { |
| 88 | let value = i |
| 89 | .as_bigint() |
| 90 | .to_u32() |
| 91 | .and_then(CodePoint::from_u32) |
| 92 | .ok_or_else(|| vm.new_value_error("chr() arg not in range(0x110000)"))?; |
| 93 | Ok(value) |
| 94 | } |
| 95 | |
| 96 | #[derive(FromArgs)] |
| 97 | #[allow(dead_code)] |