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

BSON.@save has side effects #78

Open
jonas-eschmann opened this issue Dec 29, 2020 · 1 comment
Open

BSON.@save has side effects #78

jonas-eschmann opened this issue Dec 29, 2020 · 1 comment

Comments

@jonas-eschmann
Copy link

Hi,

I just encountered following side effect (in a more complex scenario, boiled down to the minimum):

using BSON
a = Dict{Symbol, Any}(:a => Float32.([1]))
BSON.@save "/tmp/deleteme.bson" a

After that a is changed to contain all the type information that is probably generated to write the output.

Dict{Symbol,Any} with 1 entry:
  :t => Dict{Symbol,Any}(:tag=>"array",:type=>Dict{Symbol,Any}(:tag=>"datatype",:params=>Any[],:name=>Any["Core", "Float32"]),:size=>Any[3],:data=>UInt8[0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0…

After loading the dict again:

BSON.@load "/tmp/deleteme.bson" a

A is restored in its original form. To me this was unexpected behaviour and I did not find any documentation that there may be side effects when using @save.

System:

Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 7 4800H with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, znver2)

BSON:

  [fbb218c0] BSON v0.2.6

Apart from that minor issue, thanks for this fabulous library!

@racinmat
Copy link
Contributor

This probably boils down to #26 , right?

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

2 participants