Raise proper error when string of length 0 is given to `ord()`
@@ -509,7 +509,7 @@ fn builtin_ord(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
arg_check!(vm, args, required = [(string, Some(vm.ctx.str_type()))]);
let string = objstr::borrow_value(string);
let string_len = string.chars().count();
- if string_len > 1 {
+ if string_len != 1 {
return Err(vm.new_type_error(format!(
"ord() expected a character, but string of length {} found",
string_len
