ruby-changes:26099
From: ko1 <ko1@a...>
Date: Mon, 3 Dec 2012 19:03:40 +0900 (JST)
Subject: [ruby-changes:26099] ko1:r38156 (trunk): * iseq.h: iseq_catch_table_entry::catch_type should be
ko1 2012-12-03 19:03:25 +0900 (Mon, 03 Dec 2012) New Revision: 38156 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38156 Log: * iseq.h: iseq_catch_table_entry::catch_type should be Fixnum because they are pushed into Array in a compiler. [Bug #7502] * test/ruby/test_objectspace.rb: add a test of this issue. Modified files: trunk/ChangeLog trunk/iseq.h trunk/test/ruby/test_objectspace.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38155) +++ ChangeLog (revision 38156) @@ -1,3 +1,11 @@ +Mon Dec 3 18:29:27 2012 Koichi Sasada <ko1@a...> + + * iseq.h: iseq_catch_table_entry::catch_type should be + Fixnum because they are pushed into Array in a compiler. + [Bug #7502] + + * test/ruby/test_objectspace.rb: add a test of this issue. + Mon Dec 3 18:25:16 2012 Nobuyoshi Nakada <nobu@r...> * template/id.h.tmpl (preserved_ids): "empty?" is not an attribute name. Index: iseq.h =================================================================== --- iseq.h (revision 38155) +++ iseq.h (revision 38156) @@ -55,12 +55,12 @@ struct iseq_catch_table_entry { enum catch_type { - CATCH_TYPE_RESCUE, - CATCH_TYPE_ENSURE, - CATCH_TYPE_RETRY, - CATCH_TYPE_BREAK, - CATCH_TYPE_REDO, - CATCH_TYPE_NEXT + CATCH_TYPE_RESCUE = INT2FIX(1), + CATCH_TYPE_ENSURE = INT2FIX(2), + CATCH_TYPE_RETRY = INT2FIX(3), + CATCH_TYPE_BREAK = INT2FIX(4), + CATCH_TYPE_REDO = INT2FIX(5), + CATCH_TYPE_NEXT = INT2FIX(6) } type; VALUE iseq; unsigned long start; Index: test/ruby/test_objectspace.rb =================================================================== --- test/ruby/test_objectspace.rb (revision 38155) +++ test/ruby/test_objectspace.rb (revision 38156) @@ -65,4 +65,17 @@ END assert_raise(ArgumentError) { ObjectSpace.define_finalizer([], Object.new) } end + + def test_each_object + GC.disable + eval('begin; 1.times{}; rescue; ensure; end') + arys = [] + ObjectSpace.each_object(Array){|ary| + arys << ary + } + GC.enable + arys.each{|ary| + assert_equal(String, ary.inspect.class) # should not cause SEGV + } + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/