Skip to content

Serialization (de-)serializes types incorrectly for out-of-date bindings #58589

@topolarity

Description

@topolarity
struct Foo
    x::Int32
end

x = Foo(1)

struct Foo end

using Serialization
Serialization.serialize("test.jls", x)
println(x) # prints "@world(Foo, 38778:38781)(1)"
println(Serialization.deserialize("test.jls")) # prints "Foo()"

In the the other order, this even breaks the serialization format:

struct Foo end

x = Foo()

struct Foo
    x::Int32
end

using Serialization
Serialization.serialize("test.jls", x)
println(x) # prints "@world(Foo, 38775:38777)()"
println(Serialization.deserialize("test.jls")) # ERROR: EOFError: read end of file

This errors:

ERROR: EOFError: read end of file
Stacktrace:
  [1] read(s::IOStream, ::Type{UInt8})
    @ Base ./iostream.jl:424

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions