mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Modified fix for #4575 per @youknowone. Thanks, YunWon!
This commit is contained in:
1 parent
910574361c
commit
4955f05fa3
1 file changed
+3
-3
+3
-3
@@ -213,9 +213,9 @@ mod array {
|
||||
$(ArrayContentType::$n(v) => {
|
||||
// safe because every configuration of bytes for the types we
|
||||
// support are valid
|
||||
let ptr = b.as_ptr() as *const $t;
|
||||
let ptr_len = b.len() / std::mem::size_of::<$t>();
|
||||
if ptr_len > 0 {
|
||||
if b.len() > 0 {
|
||||
let ptr = b.as_ptr() as *const $t;
|
||||
let ptr_len = b.len() / std::mem::size_of::<$t>();
|
||||
let slice = unsafe { std::slice::from_raw_parts(ptr, ptr_len) };
|
||||
v.extend_from_slice(slice);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user