-
Notifications
You must be signed in to change notification settings - Fork 82
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
Saving CodeInfo sometimes errors. #243
Comments
thank for reporting this. julia> @save "test.jld2" JLD2
ERROR: TypeError: in getfield, expected Symbol, got a value of type Int64
Stacktrace:
[1] macro expansion at /home/jonas/.julia/dev/JLD2/src/data.jl:490 [inlined]
[2] h5convert!(::JLD2.IndirectPointer, ::JLD2.OnDiskRepresentation{(0, 16),Tuple{Symbol,Any},Tuple{JLD2.Vlen{String},JLD2.RelOffset}}, ::JLD2.JLDFile{JLD2.MmapIO}, ::Module, ::JLD2.JLDWriteSession{Dict{UInt64,JLD2.RelOffset}}) at /home/jonas/.julia/dev/JLD2/src/data.jl:490
[3] write_data(::JLD2.MmapIO, ::JLD2.JLDFile{JLD2.MmapIO}, ::Module, ::JLD2.OnDiskRepresentation{(0, 16),Tuple{Symbol,Any},Tuple{JLD2.Vlen{String},JLD2.RelOffset}}, ::JLD2.HasReferences, ::JLD2.JLDWriteSession{Dict{UInt64,JLD2.RelOffset}}) at /home/jonas/.julia/dev/JLD2/src/dataio.jl:117
[4] write_dataset(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.WriteDataspace{0,Tuple{}}, ::JLD2.CommittedDatatype, ::JLD2.OnDiskRepresentation{(0, 16),Tuple{Symbol,Any},Tuple{JLD2.Vlen{String},JLD2.RelOffset}}, ::Module, ::JLD2.JLDWriteSession{Dict{UInt64,JLD2.RelOffset}}) at /home/jonas/.julia/dev/JLD2/src/datasets.jl:449
[5] write_dataset at /home/jonas/.julia/dev/JLD2/src/datasets.jl:555 [inlined]
[6] write(::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, ::String, ::Module, ::JLD2.JLDWriteSession{Dict{UInt64,JLD2.RelOffset}}) at /home/jonas/.julia/dev/JLD2/src/groups.jl:119
[7] write(::JLD2.JLDFile{JLD2.MmapIO}, ::String, ::Module, ::JLD2.JLDWriteSession{Dict{UInt64,JLD2.RelOffset}}) at /home/jonas/.julia/dev/JLD2/src/JLD2.jl:339
[8] top-level scope at /home/jonas/.julia/dev/JLD2/src/loadsave.jl:66
[9] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.2/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288 I tried to fix it with the following: julia> struct ModuleName; str::String; end
julia> JLD2.writeas(::Type{Module}) = ModuleName
julia> Base.convert(::Type{ModuleName}, x::Module) = ModuleName(string(nameof(x)))
julia> Base.convert(::Type{Module}, x::ModuleName) = eval(Main, Meta.parse(x.str))
julia> @save "ci_bad" ci_bad
julia> @load "ci_bad"
ERROR: EOFError: read end of file which means that now the file can be stored but something is messed up in the loading process. So I think that more generally the problem is that |
Thanks for the explanation. I'll try out some alternative approaches then, feel free to close this if serializing this won't likely be supported. |
I'd love to make JLD2 be able to serialize all these things but I don't know enough about julia internals to fix it. (It's also hard to find out since that is not considered stable and thus mostly not documented.) Another point is that |
Not 100% sure if
CodeInfo
is meant to be supported? Minimal reproducer below (onv0.2.3
):The text was updated successfully, but these errors were encountered: