Skip to content

Marshal.dump loses Data instance attributes #3726

@gillisd

Description

@gillisd

When marshalling and unmarshalling instances of Data classes in truffleruby 24.2.0-dev-49a44754, the attribute values are lost and become nil, though the object structure is preserved:

Klass = Data.define(:foo, :bar)
test = Klass.new(foo: 1, bar: 2)
loaded = Marshal.load(Marshal.dump(test))

test.foo   # => 1
loaded.foo # => nil

test.bar   # => 2
loaded.bar # => nil

Expected behavior: The loaded object should preserve the original instance attribute values.

TruffleRuby's test suite explicitly excludes this test with the message:

exclude :test_marshal, "<#<data TestData::Klass foo=1, bar=2>> expected but was <#<data TestData::Klass foo=nil, bar=nil>>."

Is this the intended behavior for marshalling Data objects?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions