From bbba02273937d6f2dc3c3028bd1a4263048583bb Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 25 Jan 2014 02:16:20 +0000 Subject: [PATCH] class.c: allow nil keyword_hash * class.c (rb_extract_keywords): treat nil keyword_hash same as 0, for the case rb_scan_args returns nil if no keyword hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ class.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 30d8cc218b..f480079078 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jan 25 11:16:19 2014 Nobuyoshi Nakada + + * class.c (rb_extract_keywords): treat nil keyword_hash same as 0, + for the case rb_scan_args returns nil if no keyword hash. + Fri Jan 24 15:13:20 2014 Zachary Scott * lib/racc/rdoc/grammar.en.rdoc: [DOC] Correct grammar and typos diff --git a/class.c b/class.c index 25f73ecd51..2d5657d865 100644 --- a/class.c +++ b/class.c @@ -1912,6 +1912,8 @@ rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, V st_delete(rb_hash_tbl_raw(keyword_hash), &key, (val)) : \ st_lookup(rb_hash_tbl_raw(keyword_hash), key, (val))) + if (NIL_P(keyword_hash)) keyword_hash = 0; + if (optional < 0) { rest = 1; optional = -1-optional;