ruby-changes:36203
From: usa <ko1@a...>
Date: Wed, 5 Nov 2014 18:28:19 +0900 (JST)
Subject: [ruby-changes:36203] usa:r48284 (ruby_2_0_0): merge revision(s) 48102: [Backport #10413]
usa 2014-11-05 18:28:08 +0900 (Wed, 05 Nov 2014) New Revision: 48284 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48284 Log: merge revision(s) 48102: [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_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/test_keyword.rb branches/ruby_2_0_0/version.h branches/ruby_2_0_0/vm_insnhelper.c Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 48283) +++ ruby_2_0_0/ChangeLog (revision 48284) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Wed Nov 5 18:26:49 2014 NAKAMURA Usaku <usa@r...> + + * vm_insnhelper.c (unknown_keyword_error): delete expected keywords + directly from raw table, so that the given block is not called. + derived from r48102 of trunk. + [ruby-core:65837] [Bug #10413] + Mon Oct 27 20:21:05 2014 NAKAMURA Usaku <usa@r...> * lib/rexml/entity.rb: keep the entity size within the limitation. Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 48283) +++ ruby_2_0_0/version.h (revision 48284) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2014-10-28" -#define RUBY_PATCHLEVEL 595 +#define RUBY_RELEASE_DATE "2014-11-05" +#define RUBY_PATCHLEVEL 596 #define RUBY_RELEASE_YEAR 2014 -#define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 28 +#define RUBY_RELEASE_MONTH 11 +#define RUBY_RELEASE_DAY 5 #include "ruby/version.h" Index: ruby_2_0_0/vm_insnhelper.c =================================================================== --- ruby_2_0_0/vm_insnhelper.c (revision 48283) +++ ruby_2_0_0/vm_insnhelper.c (revision 48284) @@ -148,10 +148,12 @@ static void https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_insnhelper.c#L148 unknown_keyword_error(const rb_iseq_t *iseq, VALUE hash) { VALUE sep = rb_usascii_str_new2(", "), keys; + st_table *tbl = rb_hash_tbl(hash); const char *msg; int i; for (i = 0; i < iseq->arg_keywords; i++) { - rb_hash_delete(hash, ID2SYM(iseq->arg_keyword_table[i])); + st_data_t key = ID2SYM(iseq->arg_keyword_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_0_0/test/ruby/test_keyword.rb =================================================================== --- ruby_2_0_0/test/ruby/test_keyword.rb (revision 48283) +++ ruby_2_0_0/test/ruby/test_keyword.rb (revision 48284) @@ -359,4 +359,19 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_keyword.rb#L359 assert_equal([{}, {}], a.new.foo({})) assert_equal([{}, {:bar=>"x"}], a.new.foo({}, bar: "x")) 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_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r48102 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/