From 128c696c505bfd4ecf0a01bae546bfc720787fc2 Mon Sep 17 00:00:00 2001 From: marcandre Date: Tue, 15 Sep 2009 21:30:50 +0000 Subject: * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to short-circuit to the outermost level in case of recursion * test/ruby/test_thread.rb (test_recursive_outer): Test for above * hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648] * range.c (rb_range_hash): ditto * struct.c (rb_struct_hash): ditto * array.c (rb_array_hash): ditto * test/ruby/test_array.rb (test_hash2): test for above git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'array.c') diff --git a/array.c b/array.c index d16cccb75..55904ddcd 100644 --- a/array.c +++ b/array.c @@ -2884,13 +2884,15 @@ recursive_hash(VALUE ary, VALUE dummy, int recur) st_index_t h; VALUE n; + h = rb_hash_start(RARRAY_LEN(ary)); if (recur) { - rb_raise(rb_eArgError, "recursive key for hash"); + h = rb_hash_uint(h, NUM2LONG(rb_hash(rb_cArray))); } - h = rb_hash_start(RARRAY_LEN(ary)); - for (i=0; i