Project

General

Profile

Bug #12011

Updated by naruse (Yui NARUSE) over 6 years ago

Following test doesn't work. 
 A patch also attached. 
 Both of them are worked by nahi. 

 ```diff 
 diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb 
 index 482637f..262e7f6 100644 
 --- a/test/ruby/test_marshal.rb 
 +++ b/test/ruby/test_marshal.rb 
 @@ -712,4 +712,10 @@ def test_no_internal_ids 
      assert_predicate(status, :success?) 
      assert_equal(expected, out) 
    end 
 + 
 +    def test_marshal_post_proc 
 +      str = 'x' # for link 
 +      obj = [str, str] 
 +      assert_equal(['X', 'X'], Marshal.load(Marshal.dump(obj), ->(v) { v == str ? v.upcase : v })) 
 +    end 
  end 
 diff --git a/marshal.c b/marshal.c 
 index d67ce87..d64e5ff 100644 
 --- a/marshal.c 
 +++ b/marshal.c 
 @@ -1569,7 +1569,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) 
 	     rb_raise(rb_eArgError, "dump format error (unlinked)"); 
 	 } 
 	 v = (VALUE)link; 
 - 	 r_post_proc(v, arg); 
 + 	 v = r_post_proc(v, arg); 
 	 break; 
 
        case TYPE_IVAR: 
 ``` 

 


 https://github.com/ruby/ruby/pull/1204

Back