Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3a6a88445724
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d0d184fb4b63
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jun 25, 2015

  1. Copy the full SHA
    e197e98 View commit details
  2. Fixed Marshal#construct_hash to handle edge case of extended Hash

    Fixed Marshal#construct_hash to handle edge case of extended Hash
    containing user-marshaled objects. See previous commit for associated
    spec.
    sshao committed Jun 25, 2015
    Copy the full SHA
    d0d184f View commit details
Showing with 14 additions and 0 deletions.
  1. +3 −0 kernel/common/marshal.rb
  2. +11 −0 spec/ruby/core/marshal/shared/load.rb
3 changes: 3 additions & 0 deletions kernel/common/marshal.rb
Original file line number Diff line number Diff line change
@@ -555,8 +555,11 @@ def construct_hash
store_unique_object obj

construct_integer.times do
original_modules = @modules
@modules = nil
key = construct
val = construct
@modules = original_modules

# Use __store__ (an alias for []=) to get around subclass overrides
obj.__store__ key, val
11 changes: 11 additions & 0 deletions spec/ruby/core/marshal/shared/load.rb
Original file line number Diff line number Diff line change
@@ -251,6 +251,17 @@
new_obj_metaclass_ancestors[@num_self_class+1].should == UserHashInitParams
end

it "loads an extended hash object containing a user-marshaled object" do
obj = {:a => UserMarshal.new}.extend(Meths)

new_obj = Marshal.send(@method, "\004\be:\nMeths{\006:\006aU:\020UserMarshal\"\nstuff")

new_obj.should == obj
new_obj_metaclass_ancestors = class << new_obj; ancestors; end
new_obj_metaclass_ancestors[@num_self_class].should == Meths
new_obj_metaclass_ancestors[@num_self_class+1].should == Hash
end

it "preserves hash ivars when hash contains a string having ivar" do
s = 'string'
s.instance_variable_set :@string_ivar, 'string ivar'