ruby-changes:41535
From: naruse <ko1@a...>
Date: Thu, 21 Jan 2016 17:35:20 +0900 (JST)
Subject: [ruby-changes:41535] naruse:r53609 (trunk): * marshal.c (r_object0): honor Marshal.load post proc
naruse 2016-01-21 17:36:01 +0900 (Thu, 21 Jan 2016) New Revision: 53609 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53609 Log: * marshal.c (r_object0): honor Marshal.load post proc value for TYPE_LINK. by Hiroshi Nakamura <nahi@r...> https://github.com/ruby/ruby/pull/1204 fix GH-1204 Modified files: trunk/ChangeLog trunk/marshal.c trunk/test/ruby/test_marshal.rb Index: marshal.c =================================================================== --- marshal.c (revision 53608) +++ marshal.c (revision 53609) @@ -1569,7 +1569,7 @@ r_object0(struct load_arg *arg, int *ivp https://github.com/ruby/ruby/blob/trunk/marshal.c#L1569 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: Index: test/ruby/test_marshal.rb =================================================================== --- test/ruby/test_marshal.rb (revision 53608) +++ test/ruby/test_marshal.rb (revision 53609) @@ -712,4 +712,10 @@ class TestMarshal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_marshal.rb#L712 assert_predicate(status, :success?) assert_equal(expected, out) end + + def test_marshal_honor_post_proc_value_for_link + str = 'x' # for link + obj = [str, str] + assert_equal(['X', 'X'], Marshal.load(Marshal.dump(obj), ->(v) { v == str ? v.upcase : v })) + end end Index: ChangeLog =================================================================== --- ChangeLog (revision 53608) +++ ChangeLog (revision 53609) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jan 21 17:34:01 2016 NARUSE, Yui <naruse@r...> + + * marshal.c (r_object0): honor Marshal.load post proc + value for TYPE_LINK. by Hiroshi Nakamura <nahi@r...> + https://github.com/ruby/ruby/pull/1204 fix GH-1204 + Thu Jan 21 16:37:50 2016 NARUSE, Yui <naruse@r...> * Makefile.in (update-rubyspec): fix r53208 like r53451. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/