Skip to content

Commit

Permalink
Fix reinterpret arrays due to JuliaLang/julia#51962
Browse files Browse the repository at this point in the history
  • Loading branch information
mkitti committed Mar 23, 2024
1 parent ec24491 commit 5717f4c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/datasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,20 @@ function write_dataset(
end
end
end

function write_dataset(
dataset::Dataset,
memtype::Datatype,
buf::Base.ReinterpretArray,
xfer::DatasetTransferProperties=dataset.xfer
) where {T}
# We cannot obtain a pointer of a ReinterpretArrayin Julia 1.11 and beyond
# https://github.com/JuliaLang/julia/issues/51962
buf_copy = copy(buf)
@assert !(typeof(buf_copy) <: Base.ReinterpretArray) "Copying $(typeof(buf)) resulted in another Base.ReinterpretArray"
write_dataset(dataset, memtype, buf_copy, xfer)
end

function write_dataset(
dataset::Dataset,
memtype::Datatype,
Expand Down

0 comments on commit 5717f4c

Please sign in to comment.