Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix roundtrip of Tuple{Type{Int}} #485

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/data/writing_datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ const H5TYPE_DATATYPE = CompoundDatatype(
)

function h5fieldtype(f::JLDFile, ::Type{T}, readas::Type, ::Initialized) where T<:DataType
if !(readas <: DataType)
if !(readas <: DataType) || (T isa Type{Type{T}} where T)
@lookup_committed f readas
return commit(f, H5TYPE_DATATYPE, DataType, readas)
end

@lookup_committed f DataType
io = f.io
offset = f.end_of_data
Expand Down
9 changes: 7 additions & 2 deletions test/loadsave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -680,5 +680,10 @@ JLD2.rconvert(::Type{OldStructVersion}, nt::NamedTuple) = OldStructVersion(nt.x,
end
end



@testset "Issue #484 round-trip Tuple{Type{Int}}" begin
cd(mktempdir()) do
T = Tuple{Type{Int}}
jldsave("test.jld2"; T)
@test T == load("test.jld2", "T")
end
end
Loading