[前][次][番号順一覧][スレッド一覧]

ruby-changes:42328

From: naruse <ko1@a...>
Date: Tue, 29 Mar 2016 22:30:26 +0900 (JST)
Subject: [ruby-changes:42328] naruse:r54402 (ruby_2_3): merge revision(s) 53695: [Backport #12030]

naruse	2016-03-29 22:30:22 +0900 (Tue, 29 Mar 2016)

  New Revision: 54402

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54402

  Log:
    merge revision(s) 53695: [Backport #12030]
    
    * vm_eval.c (rb_check_funcall_with_hook): also should call the
      given hook before returning Qundef when overridden respond_to?
      method returned false.  [ruby-core:73556] [Bug #12030]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/test/ruby/test_hash.rb
    branches/ruby_2_3/version.h
    branches/ruby_2_3/vm_eval.c
Index: ruby_2_3/test/ruby/test_hash.rb
===================================================================
--- ruby_2_3/test/ruby/test_hash.rb	(revision 54401)
+++ ruby_2_3/test/ruby/test_hash.rb	(revision 54402)
@@ -1316,6 +1316,15 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_hash.rb#L1316
     assert_equal({dug: [:foo, :bar]}, h.dig(:d, :foo, :bar))
   end
 
+  def test_dig_with_respond_to
+    bug12030 = '[ruby-core:73556] [Bug #12030]'
+    o = Object.new
+    def o.respond_to?(*args)
+      super
+    end
+    assert_raise(TypeError) {{foo: o}.dig(:foo, :foo)}
+  end
+
   def test_cmp
     h1 = {a:1, b:2}
     h2 = {a:1, b:2, c:3}
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 54401)
+++ ruby_2_3/version.h	(revision 54402)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.0"
 #define RUBY_RELEASE_DATE "2016-03-29"
-#define RUBY_PATCHLEVEL 50
+#define RUBY_PATCHLEVEL 51
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 54401)
+++ ruby_2_3/ChangeLog	(revision 54402)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Tue Mar 29 22:26:55 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_eval.c (rb_check_funcall_with_hook): also should call the
+	  given hook before returning Qundef when overridden respond_to?
+	  method returned false.  [ruby-core:73556] [Bug #12030]
+
 Tue Mar 29 22:08:36 2016  Kazuki Yamaguchi  <k@r...>
 
 	* compile.c (iseq_peephole_optimize): don't apply tailcall
Index: ruby_2_3/vm_eval.c
===================================================================
--- ruby_2_3/vm_eval.c	(revision 54401)
+++ ruby_2_3/vm_eval.c	(revision 54402)
@@ -478,8 +478,10 @@ rb_check_funcall_with_hook(VALUE recv, I https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_eval.c#L478
     rb_thread_t *th = GET_THREAD();
     int respond = check_funcall_respond_to(th, klass, recv, mid);
 
-    if (!respond)
+    if (!respond) {
+	(*hook)(FALSE, recv, mid, argc, argv, arg);
 	return Qundef;
+    }
 
     me = rb_search_method_entry(recv, mid);
     if (!check_funcall_callable(th, me)) {

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r53695


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]