Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ class C3(C2): pass
c3 = C3()
self.assertTrue(callable(c3))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_chr(self):
self.assertEqual(chr(32), ' ')
self.assertEqual(chr(65), 'A')
Expand Down
6 changes: 3 additions & 3 deletions vm/src/stdlib/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod builtins {
IdProtocol, ItemProtocol, PyArithmeticValue, PyClassImpl, PyObjectRef, PyRef, PyResult,
PyValue, TryFromObject, TypeProtocol, VirtualMachine,
};
use num_traits::{Signed, Zero};
use num_traits::{Signed, ToPrimitive, Zero};

#[pyfunction]
fn abs(x: PyObjectRef, vm: &VirtualMachine) -> PyResult {
Expand Down Expand Up @@ -87,8 +87,8 @@ mod builtins {
}

#[pyfunction]
fn chr(i: u32, vm: &VirtualMachine) -> PyResult<String> {
match std::char::from_u32(i) {
fn chr(i: PyIntRef, vm: &VirtualMachine) -> PyResult<String> {
match i.as_bigint().to_u32().and_then(char::from_u32) {
Some(value) => Ok(value.to_string()),
None => Err(vm.new_value_error("chr() arg not in range(0x110000)".to_owned())),
}
Expand Down