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

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
This commit is contained in:
nobu 2014-01-25 02:16:20 +00:00
parent 6a634322e6
commit bbba022739
2 changed files with 7 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Sat Jan 25 11:16:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <e@zzak.io>
* lib/racc/rdoc/grammar.en.rdoc: [DOC] Correct grammar and typos

View file

@ -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;