X Tutup
Skip to content

Commit 28bda1d

Browse files
authored
Fix error message in ctypes (#7368)
* Remove unnecessary `to_{owned,string}()` calls (#7367) * Fix error message in ctype
1 parent 89889ac commit 28bda1d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/vm/src/stdlib/ctypes/array.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,9 +798,10 @@ impl PyCArray {
798798
} else if let Ok(int_val) = value.try_index(vm) {
799799
(int_val.as_bigint().to_usize().unwrap_or(0), None)
800800
} else {
801-
return Err(
802-
vm.new_type_error("bytes or integer address expected instead of {}")
803-
);
801+
return Err(vm.new_type_error(format!(
802+
"bytes or integer address expected instead of {} instance",
803+
value.class().name()
804+
)));
804805
};
805806
if offset + element_size <= buffer.len() {
806807
buffer[offset..offset + element_size].copy_from_slice(&ptr_val.to_ne_bytes());

0 commit comments

Comments
 (0)
X Tutup