Issue #12011 has been updated by Yui NARUSE.

Description updated

----------------------------------------
Bug #12011: honor Marshal.load post proc value for TYPE_LINK
https://bugs.ruby-lang.org/issues/12011#change-56178

* Author: Yui NARUSE
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
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



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>