symengine / SymEngine.jl

Julia wrappers of SymEngine
MIT License
192 stars 43 forks source link

Serialization don't work with complex data types containing SymEngine expressions #255

Closed PerformanceCoder closed 2 years ago

PerformanceCoder commented 2 years ago

Hi!

It seems that SymEngine expressions can't be deserialized if they are included in complex types (arrays, structures, etc.).

To reproduce the problem, the following code should be executed:

using SymEngine, Serialization

@vars x y
expr = x + y

open("test.bin", "w") do f
    serialize(f, [expr, "Hello world"])
end

open("test.bin", "r") do f
    expr2 = deserialize(f)
    print(expr2)
end

Expected result: message containing x + y and Hello world. Actual result: EOFError: read end of file.

Interestingly, ["Hello world", expr] serializes as expected.