diff options
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -584,9 +584,10 @@ rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash) if (block_given) return rb_yield(key); if (argc == 1) { volatile VALUE desc = rb_protect(rb_inspect, key, 0); - if (NIL_P(desc) || RSTRING_LEN(desc) > 65) { + if (NIL_P(desc)) { desc = rb_any_to_s(key); } + desc = rb_str_ellipsize(desc, 65); rb_raise(rb_eKeyError, "key not found: %s", RSTRING_PTR(desc)); } return if_none; |