Skip to content

Commit abd0e65

Browse files
committed
Keep the bytearray wording in PyByteArray_FromObject
It called `bytes_from_object`, so the previous commit made it report "bytes must be in range(0, 256)" where CPython's `PyByteArray_FromObject` says "byte". It is the C-level bytearray constructor, so it now uses `bytearray_from_object`, which carries that wording and the constructor's unsized iteration. Assisted-by: Claude Code:claude-opus-5
1 parent e07c6b5 commit abd0e65

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎crates/capi/src/bytearrayobject.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::object::define_py_check;
33
use crate::pystate::with_vm;
44
use core::ffi::c_char;
55
use rustpython_vm::builtins::PyByteArray;
6-
use rustpython_vm::byte::bytes_from_object;
6+
use rustpython_vm::byte::bytearray_from_object;
77

88
define_py_check!(fn PyByteArray_Check, types.bytearray_type);
99

@@ -41,7 +41,7 @@ pub unsafe extern "C" fn PyByteArray_FromStringAndSize(
4141
pub unsafe extern "C" fn PyByteArray_FromObject(obj: *mut PyObject) -> *mut PyObject {
4242
with_vm(|vm| {
4343
let obj = unsafe { &*obj };
44-
let data = bytes_from_object(vm, obj)?;
44+
let data = bytearray_from_object(vm, obj)?;
4545
Ok(vm.ctx.new_bytearray(data))
4646
})
4747
}

0 commit comments

Comments
 (0)