diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-03 10:03:25 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-03 10:03:25 +0000 |
commit | c4f9dd26263da640a2c9a02c478df245685e2b69 (patch) | |
tree | 842c99b744769dc41ba89082979c0d0b5d398f82 | |
parent | 17a2be29b91b971d28f4d0f2381973ee65fc13c4 (diff) |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | iseq.h | 12 | ||||
-rw-r--r-- | test/ruby/test_objectspace.rb | 13 |
3 files changed, 27 insertions, 6 deletions
@@ -1,3 +1,11 @@ +Mon Dec 3 18:29:27 2012 Koichi Sasada <ko1@atdot.net> + + * 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@ruby-lang.org> * template/id.h.tmpl (preserved_ids): "empty?" is not an attribute name. @@ -55,12 +55,12 @@ struct iseq_line_info_entry { 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; diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb index 24731a7a50..921de84c0b 100644 --- a/test/ruby/test_objectspace.rb +++ b/test/ruby/test_objectspace.rb @@ -65,4 +65,17 @@ End 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 |