summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-28 02:40:46 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-28 02:40:46 (GMT)
commit4191a6b90d3eeb63a31609dba29a1904efee3738 (patch)
tree6689e8d252ca17f1f90626d7ade4b144dbfccdd7 /array.c
parent7d49923e9e9a9d1a01f3183fd798258e9d289da0 (diff)
preserve encodings in error messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 3a6e231..44eaa20 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)",