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

Nightlyfix #615

Merged
merged 2 commits into from
Nov 6, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.5.8
- Stop using `Base.module_keys` as it is removed on nightly

## 0.5.7
- Fix edge case for uninitialized Vlens

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "JLD2"
uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
version = "0.5.7"
version = "0.5.8"

[deps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Expand Down
4 changes: 1 addition & 3 deletions src/data/reconstructing_datatypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ function _resolve_type(rr::MappedRepr{T,DataTypeODR},
hasparams::Bool,
params) where T
parts = split(mypath, '.')
modules = vcat([Main], collect(keys(Base.module_keys)))
unique!(modules)
for mod in modules
for mod in values(Base.loaded_modules)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should preferably use Base.loaded_modules_array, as that has been the stable and safe API for this for many versions (since JuliaLang/julia#23579), while this is neither safe nor stable

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I didn't know that function existed.
Thanks, I'll switch to that in the next release.

resolution_attempt = _resolve_type_singlemodule(rr,
mod,
parts,
Expand Down
6 changes: 3 additions & 3 deletions src/io/dataio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ function write_data(io::MemoryBackedIO, f::JLDFile, data::Array, odr, ::Referenc
nothing
end

function write_data(io::MemoryBackedIO, f::JLDFile, data::Array, odr, ::HasReferences, wsession::JLDWriteSession)
function write_data(io::MemoryBackedIO, f::JLDFile, data::Array, odr::ODR, ::HasReferences, wsession::JLDWriteSession) where ODR
ensureroom(io, odr_sizeof(odr) * length(data))
cp = IndirectPointer(io)

for i = eachindex(data)
if isassigned(data, i)
h5convert!(cp, odr, f, data[i], wsession)
Expand Down Expand Up @@ -273,4 +273,4 @@ function read_array!(v::Array{T}, f::JLDFile{MmapIO}, ::SameRepr{T}) where T
end
io.curptr = inptr + nb
v
end
end
2 changes: 1 addition & 1 deletion test/modules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ S = BType(x)
end

@testset "name collisions" begin
mods = collect(keys(Base.module_keys))
mods = collect(values(Base.loaded_modules))
# use whichever module would not be found first in a linear search
M = findfirst(==(A), mods) < findfirst(==(B), mods) ? B : A
x = M.SameNameType(42)
Expand Down
Loading