From ca8b2d26f03b5bb5e71a0de6bab1580b6326fe14 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 25 Feb 2016 10:27:07 +0000 Subject: merge revision(s) 53609: [Backport #12011] * marshal.c (r_object0): honor Marshal.load post proc value for TYPE_LINK. by Hiroshi Nakamura https://github.com/ruby/ruby/pull/1204 fix GH-1204 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@53934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ marshal.c | 2 +- test/ruby/test_marshal.rb | 6 ++++++ version.h | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8174289ac9..2a53127360 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Feb 25 19:25:25 2016 NARUSE, Yui + + * marshal.c (r_object0): honor Marshal.load post proc + value for TYPE_LINK. by Hiroshi Nakamura + https://github.com/ruby/ruby/pull/1204 fix GH-1204 + Thu Feb 25 18:59:27 2016 Nobuyoshi Nakada * ext/socket/option.c (sockopt_bool): relax boolean size to be one diff --git a/marshal.c b/marshal.c index 9aba5e3204..fd6e12f0d9 100644 --- a/marshal.c +++ b/marshal.c @@ -1499,7 +1499,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: diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 967aa37723..14c49faca3 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -606,4 +606,10 @@ class TestMarshal < Test::Unit::TestCase Marshal.dump(TestForRespondToFalse.new) end 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 diff --git a/version.h b/version.h index e8b8d7310a..14945bf5df 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.9" #define RUBY_RELEASE_DATE "2016-02-25" -#define RUBY_PATCHLEVEL 452 +#define RUBY_PATCHLEVEL 453 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 2 -- cgit v1.2.3