aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/array.c b/array.c
index 3a6e231a6e..44eaa20cfe 100644
--- a/array.c
+++ b/array.c
@@ -2170,10 +2170,11 @@ rb_ary_to_h(VALUE ary)
long i;
VALUE hash = rb_hash_new();
for (i=0; i<RARRAY_LEN(ary); i++) {
- VALUE key_value_pair = rb_check_array_type(rb_ary_elt(ary, i));
+ const VALUE elt = rb_ary_elt(ary, i);
+ const VALUE key_value_pair = rb_check_array_type(elt);
if (NIL_P(key_value_pair)) {
- rb_raise(rb_eTypeError, "wrong element type %s at %ld (expected array)",
- rb_builtin_class_name(rb_ary_elt(ary, i)), i);
+ rb_raise(rb_eTypeError, "wrong element type %"PRIsVALUE" at %ld (expected array)",
+ rb_obj_class(elt), i);
}
if (RARRAY_LEN(key_value_pair) != 2) {
rb_raise(rb_eArgError, "wrong array length at %ld (expected 2, was %ld)",