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

ruby-changes:36056

From: nagachika <ko1@a...>
Date: Sun, 26 Oct 2014 03:29:16 +0900 (JST)
Subject: [ruby-changes:36056] nagachika:r48137 (ruby_2_1): merge revision(s) r48102: [Backport #10413]

nagachika	2014-10-26 03:29:00 +0900 (Sun, 26 Oct 2014)

  New Revision: 48137

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

  Log:
    merge revision(s) r48102: [Backport #10413]
    
    * class.c (unknown_keyword_error): delete expected keywords
      directly from raw table, so that the given block is not called.
      [ruby-core:65837] [Bug #10413]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/class.c
    branches/ruby_2_1/test/ruby/test_keyword.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 48136)
+++ ruby_2_1/ChangeLog	(revision 48137)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Sun Oct 26 03:21:30 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* class.c (unknown_keyword_error): delete expected keywords
+	  directly from raw table, so that the given block is not called.
+	  [ruby-core:65837] [Bug #10413]
+
 Wed Oct 22 23:02:49 2014  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 	* ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override
Index: ruby_2_1/class.c
===================================================================
--- ruby_2_1/class.c	(revision 48136)
+++ ruby_2_1/class.c	(revision 48137)
@@ -1876,10 +1876,12 @@ NORETURN(static void unknown_keyword_err https://github.com/ruby/ruby/blob/trunk/ruby_2_1/class.c#L1876
 static void
 unknown_keyword_error(VALUE hash, const ID *table, int keywords)
 {
+    st_table *tbl = rb_hash_tbl_raw(hash);
     VALUE keys;
     int i;
     for (i = 0; i < keywords; i++) {
-	rb_hash_delete(hash, ID2SYM(table[i]));
+	st_data_t key = ID2SYM(table[i]);
+	st_delete(tbl, &key, NULL);
     }
     keys = rb_funcall(hash, rb_intern("keys"), 0, 0);
     if (!RB_TYPE_P(keys, T_ARRAY)) rb_raise(rb_eArgError, "unknown keyword");
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 48136)
+++ ruby_2_1/version.h	(revision 48137)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.4"
-#define RUBY_RELEASE_DATE "2014-10-22"
-#define RUBY_PATCHLEVEL 262
+#define RUBY_RELEASE_DATE "2014-10-26"
+#define RUBY_PATCHLEVEL 263
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 10
-#define RUBY_RELEASE_DAY 22
+#define RUBY_RELEASE_DAY 26
 
 #include "ruby/version.h"
 
Index: ruby_2_1/test/ruby/test_keyword.rb
===================================================================
--- ruby_2_1/test/ruby/test_keyword.rb	(revision 48136)
+++ ruby_2_1/test/ruby/test_keyword.rb	(revision 48137)
@@ -505,4 +505,19 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_keyword.rb#L505
       tap { prc.call }
     }, bug8964
   end
+
+  def test_unknown_keyword_with_block
+    bug10413 = '[ruby-core:65837] [Bug #10413]'
+    class << (o = Object.new)
+      def bar(k2: 'v2')
+      end
+
+      def foo
+        bar(k1: 1)
+      end
+    end
+    assert_raise_with_message(ArgumentError, /unknown keyword: k1/, bug10413) {
+      o.foo {raise "unreachable"}
+    }
+  end
 end

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r48102


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

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