summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/enum.c b/enum.c
index c7828cdb01..b3a8f9e1d8 100644
--- a/enum.c
+++ b/enum.c
@@ -1069,10 +1069,14 @@ static VALUE
enum_tally(int argc, VALUE *argv, VALUE obj)
{
VALUE hash;
- if (rb_check_arity(argc, 0, 1))
- hash = rb_check_hash_type(argv[0]);
- else
+ if (rb_check_arity(argc, 0, 1)) {
+ hash = rb_convert_type(argv[0], T_HASH, "Hash", "to_hash");
+ rb_check_frozen(hash);
+ }
+ else {
hash = rb_hash_new();
+ }
+
return enum_hashify_into(obj, 0, 0, tally_i, hash);
}