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

Failing to serialize lambda function when using BSON #105

Open
racinmat opened this issue May 5, 2021 · 0 comments
Open

Failing to serialize lambda function when using BSON #105

racinmat opened this issue May 5, 2021 · 0 comments

Comments

@racinmat
Copy link

racinmat commented May 5, 2021

Lambda function fails to deserialize in JLSO 2.5.0 and BSON 0.3.3.
Here is MWE

julia>         using JLSO
               a_fun = ()->nothing
               io = IOBuffer()
               JLSO.save(io, Dict(:a_fun=>a_fun), format=:bson; compression=:gzip)
               seek(io, 0)
               data_loaded = JLSO.load(io)
[warn | JLSO]: MethodError: no method matching BSON.__deserialized_types__.var"#15#16"()
Dict{Symbol,Any} with 1 entry:
  :a_fun => UInt8[0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a    0x7e, 0x03, 0x16, 0xdc, 0xd0, 0x72, 0xc2, 0x13, 0x00, 0x00]

persistence works, but loading not, and it loads lambda function only as bytes.

Using pure BSON, it works

julia>         using BSON
               io = IOBuffer()
               BSON.bson(io, Dict(:a_fun=>a_fun))
               seek(io, 0)
               data_loaded = BSON.load(io)
Dict{Symbol,Any} with 1 entry:
  :a_fun => #17

This bug is replicable also with JLSO versions 2.4, 2.3.3, 2.2 and BSON 0.2.6, 0.2.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant