8000 merge revision(s) r48102: [Backport #10413] · github/ruby@a7a045f · GitHub
[go: up one dir, main page]

Skip to content

Commit a7a045f

Browse files
committed
merge revision(s) r48102: [Backport ruby#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 ruby#10413] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 5a58165 commit a7a045f

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Sun Oct 26 03:21:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* class.c (unknown_keyword_error): delete expected keywords
4+
directly from raw table, so that the given block is not called.
5+
[ruby-core:65837] [Bug #10413]
6+
17
Wed Oct 22 23:02:49 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
28

39
* ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override

class.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,10 +1876,12 @@ NORETURN(static void unknown_keyword_error(VALUE hash, const ID *table, int keyw
18761876
static void
18771877
unknown_keyword_error(VALUE hash, const ID *table, int keywords)
18781878
{
1879+
st_table *tbl = rb_hash_tbl_raw(hash);
18791880
VALUE keys;
18801881
int i;
18811882
for (i = 0; i < keywords; i++) {
1882-
rb_hash_delete(hash, ID2SYM(table[i]));
1883+
st_data_t key = ID2SYM(table[i]);
1884+
st_delete(tbl, &key, NULL);
18831885
}
18841886
keys = rb_funcall(hash, rb_intern("keys"), 0, 0);
18851887
if (!RB_TYPE_P(keys, T_ARRAY)) rb_raise(rb_eArgError, "unknown keyword");

test/ruby/test_keyword.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,4 +505,19 @@ def m(a: [])
505505
tap { prc.call }
506506
}, bug8964
507507
end
508+
509+
def test_unknown_keyword_with_block
510+
bug10413 = '[ruby-core:65837] [Bug #10413]'
511+
class << (o = Object.new)
512+
def bar(k2: 'v2')
513+
end
514+
515+
def foo
516+
bar(k1: 1)
517+
end
518+
end
519+
assert_raise_with_message(ArgumentError, /unknown keyword: k1/, bug10413) {
520+
o.foo {raise "unreachable"}
521+
}
522+
end
508523
end

version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#define RUBY_VERSION "2.1.4"
2-
#define RUBY_RELEASE_DATE "2014-10-22"
3-
#define RUBY_PATCHLEVEL 262
2+
#define RUBY_RELEASE_DATE "2014-10-26"
3+
#define RUBY_PATCHLEVEL 263
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 10
7-
#define RUBY_RELEASE_DAY 22
7+
#define RUBY_RELEASE_DAY 26
88

99
#include "ruby/version.h"
1010

0 commit comments

Comments
 (0)
0