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

Marshal.dump loses Data instance attributes #3726

Closed
gillisd opened this issue Nov 22, 2024 · 2 comments
Closed

Marshal.dump loses Data instance attributes #3726

gillisd opened this issue Nov 22, 2024 · 2 comments

Comments

@gillisd
Copy link

gillisd commented Nov 22, 2024

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?
@andrykonchin
Copy link
Member

Thank you for the report, we'll look into it.

Yes, it's definitely an issue and it should be fixed.

@andrykonchin
Copy link
Member

Fixed in 7b2cc51

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

No branches or pull requests

2 participants