Don't try to marshal non-serializable variables#7739
Merged
headius merged 2 commits intojruby:masterfrom Mar 29, 2023
Merged
Conversation
This avoids marshaling the __finalizer__ slot and any other internal state that is not serializable. Fixes jruby#7734
eregon
reviewed
Apr 25, 2023
|
|
||
| it "dumps without marshaling any attached finalizer" do | ||
| obj = Object.new | ||
| ObjectSpace.define_finalizer(obj, &:itself) |
Member
There was a problem hiding this comment.
FYI this causes:
1)
Marshal.dump with an Object dumps without marshaling any attached finalizer ERROR
ArgumentError: Can't create Binding from C level Proc
/home/eregon/code/rubyspec/core/marshal/dump_spec.rb:464:in `define_finalizer'
/home/eregon/code/rubyspec/core/marshal/dump_spec.rb:464:in `block (3 levels) in <top (required)>'
/home/eregon/code/rubyspec/core/marshal/dump_spec.rb:6:in `<top (required)>'
[| | ==================100%================== | 00:00:00] 0F 1E
on CRuby 3.0+. Just on 2.7 it seems to work.
I modified the spec a bit to make it work on all CRuby versions: ruby/spec@d44cd79
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes #7734 by not confusing the finalizer with marshalable state.