net-imap icon indicating copy to clipboard operation
net-imap copied to clipboard

🔥 Use psych (>= 5.2.5) for encoding Data objects

Open nevans opened this issue 2 months ago • 2 comments

Depends on #541, which drops the Data polyfill.

Unlike #541, this is a breaking change, because objects that would previously encode with a ruby/object:Net::IMAP:DataSubclass tag will instead encode with a ruby/data:Net::IMAP:DataSubclass tag. Any YAML with the old tag will create an (effectively) empty data object: the data members will not be initialized (but ivars will be set).

nevans avatar Oct 16 '25 17:10 nevans

@eregon It looks like TruffleRuby doesn't like the Data deserialization that was added to psych 5.2.5 (ruby/psych#692). For !ruby/data tagged objects, Psych::Visitors::ToRuby calls #init_struct which calls rb_struct_initialize, and that symbol understandably isn't found for TruffleRuby. I used that in ruby/psych#692 because that's how CRuby's Marshal handles both Struct and Data objects.

I guess TruffleRuby will either need to support a compatible rb_struct_initialize, or it will need to patch Psych::Visitors::ToRuby#init_struct?

nevans avatar Oct 16 '25 18:10 nevans

Could you file an issue at https://github.com/truffleruby/truffleruby/issues ? Obviously we should add TruffleRuby in ruby/psych CI to catch earlier in the future.

eregon avatar Oct 20 '25 19:10 eregon