aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index b8acbc8491..c3e5931be0 100644
--- a/hash.c
+++ b/hash.c
@@ -15,6 +15,7 @@
#include "ruby/st.h"
#include "ruby/util.h"
#include "ruby/encoding.h"
+#include "internal.h"
#include <errno.h>
#ifdef __APPLE__
@@ -392,11 +393,14 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
hash = hash_alloc(klass);
for (i = 0; i < RARRAY_LEN(tmp); ++i) {
- VALUE v = rb_check_array_type(RARRAY_PTR(tmp)[i]);
+ VALUE e = RARRAY_PTR(tmp)[i];
+ VALUE v = rb_check_array_type(e);
VALUE key, val = Qnil;
if (NIL_P(v)) {
- rb_raise(rb_eArgError, "wrong element type (expected array)");
+ rb_raise(rb_eArgError, "wrong element type %s at %ld (expected array)",
+ rb_builtin_class_name(e), i);
+
}
switch (RARRAY_LEN(v)) {
default: