1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-10-25 18:29:00 +00:00
parent c8137d676a
commit c4e838d011
4 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Sun Oct 26 03:21:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@ruby-lang.org>
* ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override

View file

@ -1876,10 +1876,12 @@ NORETURN(static void unknown_keyword_error(VALUE hash, const ID *table, int keyw
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");

View file

@ -505,4 +505,19 @@ class TestKeywordArguments < Test::Unit::TestCase
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

View file

@ -1,10 +1,10 @@
#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"