Skip to content

Commit 94240f1

Browse files
authored
Fixed bytes_from_object (RustPython#3739)
1 parent 3dabaa8 commit 94240f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vm/src/bytesinner.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,10 @@ pub fn bytes_from_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Vec<u8
12121212
return Ok(elements);
12131213
}
12141214

1215-
if let Ok(elements) = vm.map_iterable_object(obj, |x| value_from_object(vm, &x)) {
1216-
return elements;
1215+
if !obj.fast_isinstance(&vm.ctx.types.str_type) {
1216+
if let Ok(elements) = vm.map_iterable_object(obj, |x| value_from_object(vm, &x)) {
1217+
return elements;
1218+
}
12171219
}
12181220

12191221
Err(vm.new_type_error(

0 commit comments

Comments
 (0)