Fixed `bytes_from_object`
@@ -1212,9 +1212,11 @@ pub fn bytes_from_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Vec<u8
return Ok(elements);
}
+ if !obj.fast_isinstance(&vm.ctx.types.str_type) {
if let Ok(elements) = vm.map_iterable_object(obj, |x| value_from_object(vm, &x)) {
return elements;
}
+ }
Err(vm.new_type_error(
"can assign only bytes, buffers, or iterables of ints in range(0, 256)".to_owned(),
