ruby-changes:23933
From: nobu <ko1@a...>
Date: Sat, 9 Jun 2012 17:22:04 +0900 (JST)
Subject: [ruby-changes:23933] nobu:r35984 (trunk): iseq.c: fix conversion
nobu 2012-06-09 17:21:52 +0900 (Sat, 09 Jun 2012) New Revision: 35984 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35984 Log: iseq.c: fix conversion * iseq.c (iseq_load): type is a symbol, and invalid as ID in common. Modified files: trunk/ChangeLog trunk/iseq.c trunk/test/ruby/test_iseq.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 35983) +++ ChangeLog (revision 35984) @@ -1,3 +1,7 @@ +Sat Jun 9 17:21:48 2012 Nobuyoshi Nakada <nobu@r...> + + * iseq.c (iseq_load): type is a symbol, and invalid as ID in common. + Sat Jun 9 10:57:14 2012 Tanaka Akira <akr@f...> * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err. Index: iseq.c =================================================================== --- iseq.c (revision 35983) +++ iseq.c (revision 35984) @@ -516,11 +516,12 @@ } if (st_lookup(type_map, type, &iseq_type) == 0) { - const char *typename = rb_id2name(type); + ID typeid = SYM2ID(type); + const char *typename = rb_id2name(typeid); if (typename) rb_raise(rb_eTypeError, "unsupport type: :%s", typename); else - rb_raise(rb_eTypeError, "unsupport type: %p", (void *)type); + rb_raise(rb_eTypeError, "unsupport type: %p", (void *)typeid); } if (parent == Qnil) { Index: test/ruby/test_iseq.rb =================================================================== --- test/ruby/test_iseq.rb (revision 35983) +++ test/ruby/test_iseq.rb (revision 35984) @@ -8,4 +8,11 @@ bug5894 = '[ruby-dev:45130]' assert_normal_exit('p RubyVM::InstructionSequence.compile("1", "mac", "", 0).to_a', bug5894) end + + def test_unsupport_type + ary = RubyVM::InstructionSequence.compile("p").to_a + ary[9] = :foobar + e = assert_raise(TypeError) {RubyVM::InstructionSequence.load(ary)} + assert_match(/:foobar/, e.message) + end if defined?(RubyVM::InstructionSequence.load) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/