Closed lucaferranti closed 7 months ago
The problematic bit is the Module Core
node in the expression tree. The following causes the same error
julia> a = Core
Core
julia> save_object("tmp.jld2", a)
ERROR: Type Module does not have a definite size.
Stacktrace:
[1] sizeof
@ ./essentials.jl:559 [inlined]
[2] hasdata(T::DataType, encounteredtypes::Vector{DataType})
@ JLD2 ~/.julia/packages/JLD2/u57Vt/src/data/writing_datatypes.jl:39
[3] hasdata
@ ~/.julia/packages/JLD2/u57Vt/src/data/writing_datatypes.jl:39 [inlined]
[4] odr(#unused#::Type{Module})
@ JLD2 ~/.julia/packages/JLD2/u57Vt/src/data/writing_datatypes.jl:592
[5] objodr
@ ~/.julia/packages/JLD2/u57Vt/src/data/writing_datatypes.jl:119 [inlined]
[6] write_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, x::Module, wsession::JLD2.JLDWriteSession{Dict{UInt64, JLD2.RelOffset}})
@ JLD2 ~/.julia/packages/JLD2/u57Vt/src/datasets.jl:645
[7] write(g::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, name::String, obj::Module, wsession::JLD2.JLDWriteSession{Dict{UInt64, JLD2.RelOffset}}; compress::Nothing)
@ JLD2 ~/.julia/packages/JLD2/u57Vt/src/compression.jl:137
[8] write (repeats 2 times)
@ ~/.julia/packages/JLD2/u57Vt/src/compression.jl:125 [inlined]
[9] setindex!
@ ~/.julia/packages/JLD2/u57Vt/src/groups.jl:125 [inlined]
[10] setindex!
@ ~/.julia/packages/JLD2/u57Vt/src/JLD2.jl:484 [inlined]
[11] (::JLD2.var"#77#78"{Module})(file::JLD2.JLDFile{JLD2.MmapIO})
@ JLD2 ~/.julia/packages/JLD2/u57Vt/src/loadsave.jl:186
[12] jldopen(::Function, ::String, ::Vararg{String}; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JLD2 ~/.julia/packages/JLD2/u57Vt/src/loadsave.jl:4
[13] jldopen
@ ~/.julia/packages/JLD2/u57Vt/src/loadsave.jl:1 [inlined]
[14] save_object(filename::String, x::Module)
@ JLD2 ~/.julia/packages/JLD2/u57Vt/src/loadsave.jl:185
[15] top-level scope
@ REPL[46]:1
Thanks for the report!
I suppose one could implement a custom serialization for module (names).
It doesn't make sense for most modules, but Core and Base might be useful.
It doesn't make sense for most modules,
I'm curious why you say so. Isn't it the same as for functions? You can't save its "true state", but saving as a reference is useful.
It doesn't make sense for most modules,
I'm curious why you say so. Isn't it the same as for functions? You can't save its "true state", but saving as a reference is useful.
Yes, that is quite similar and I would say the same about functions... Nonetheless, for package-modules this should now work fine! (with v0.4.40)
An
Int128
literal is a macro call in disguiseCurrently, when trying to save to a jld2 file the expression above, it errors
My system version info