diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-11 09:30:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-11 09:30:31 +0000 |
commit | 4d57720d1a8f8bdc492e6988bb01a716c814cbbd (patch) | |
tree | fa88b2cc3b0305c9a4808925566af5416e610482 /hash.c | |
parent | 19294fbb8d2cb8ce23d45a0af927c9d5df65f60d (diff) | |
download | ruby-4d57720d1a8f8bdc492e6988bb01a716c814cbbd.tar.gz |
sprintf.c: nil value is valid
* sprintf.c (rb_str_format): look up the key, then get default
value and raise KeyError if the returned value is nil.
[ruby-dev:49338] [Ruby trunk - Bug #11677]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -758,8 +758,8 @@ rb_hash_rehash(VALUE hash) return hash; } -static VALUE -hash_default_value(VALUE hash, VALUE key) +VALUE +rb_hash_default_value(VALUE hash, VALUE key) { if (rb_method_basic_definition_p(CLASS_OF(hash), id_default)) { VALUE ifnone = RHASH_IFNONE(hash); @@ -792,7 +792,7 @@ rb_hash_aref(VALUE hash, VALUE key) st_data_t val; if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) { - return hash_default_value(hash, key); + return rb_hash_default_value(hash, key); } return (VALUE)val; } @@ -1184,7 +1184,7 @@ rb_hash_shift(VALUE hash) } } } - return hash_default_value(hash, Qnil); + return rb_hash_default_value(hash, Qnil); } static int |