summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-09 08:21:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-09 08:21:52 +0000
commit588d10180fbf05228aec2882f74dd3236dd3ad01 (patch)
treeca05ed4b48742cc2f85d1c7cbb0577d1e9f58551
parenta46bf824bf3a6aace879b06159382e0905a48d78 (diff)
iseq.c: fix conversion
* iseq.c (iseq_load): type is a symbol, and invalid as ID in common. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--iseq.c5
-rw-r--r--test/ruby/test_iseq.rb7
3 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e8da483215..6a07201574 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Jun 9 17:21:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * iseq.c (iseq_load): type is a symbol, and invalid as ID in common.
+
Sat Jun 9 10:57:14 2012 Tanaka Akira <akr@fsij.org>
* process.c (rb_exec_async_signal_safe): extracted from rb_exec_err.
diff --git a/iseq.c b/iseq.c
index f75911cab0..015e2a317f 100644
--- a/iseq.c
+++ b/iseq.c
@@ -516,11 +516,12 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
}
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) {
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 2b25630e57..2fa8f2399a 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -8,4 +8,11 @@ class TestISeq < Test::Unit::TestCase
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