Revision: 5249 http://trac.macosforge.org/projects/ruby/changeset/5249 Author: watson1978@gmail.com Date: 2011-03-03 23:40:52 -0800 (Thu, 03 Mar 2011) Log Message: ----------- Array#replace will raise RuntimeError when was frozen object. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions a = [ 1, 2, 3].freeze assert_raise(RuntimeError){ a.replace(42) } puts :ok }}} Modified Paths: -------------- MacRuby/trunk/array.c Modified: MacRuby/trunk/array.c =================================================================== --- MacRuby/trunk/array.c 2011-02-26 01:27:10 UTC (rev 5248) +++ MacRuby/trunk/array.c 2011-03-04 07:40:52 UTC (rev 5249) @@ -2170,8 +2170,8 @@ static VALUE rary_replace(VALUE rcv, SEL sel, VALUE other) { + rary_modify(rcv); other = to_ary(other); - rary_modify(rcv); rary_remove_all(RARY(rcv)); rary_concat(rcv, other, 0, RARRAY_LEN(other)); return rcv;