diff --git a/ChangeLog b/ChangeLog index 2284a5f770..5ea7021cdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Nov 24 02:03:30 2014 Nobuyoshi Nakada + + * iseq.c (rb_insn_operand_intern): preserve encoding of method + name in CALL_INFO at disassembling. + Mon Nov 24 02:02:59 2014 Nobuyoshi Nakada * io.c (must_respond_to): preserve encodings of variable name and diff --git a/iseq.c b/iseq.c index 08a7918353..f290ed4692 100644 --- a/iseq.c +++ b/iseq.c @@ -1230,7 +1230,7 @@ rb_insn_operand_intern(const rb_iseq_t *iseq, VALUE ary = rb_ary_new(); if (ci->mid) { - rb_ary_push(ary, rb_sprintf("mid:%s", rb_id2name(ci->mid))); + rb_ary_push(ary, rb_sprintf("mid:%"PRIsVALUE, rb_id2str(ci->mid))); } rb_ary_push(ary, rb_sprintf("argc:%d", ci->orig_argc)); diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 79c41bb900..d7d15c7703 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -52,13 +52,14 @@ class TestISeq < Test::Unit::TestCase end if defined?(RubyVM::InstructionSequence.load) def test_disasm_encoding - src = "\u{3042} = 1; \u{3042}" - enc, Encoding.default_internal = Encoding.default_internal, src.encoding - assert_equal(src.encoding, RubyVM::InstructionSequence.compile(src).disasm.encoding) + src = "\u{3042} = 1; \u{3042}; \u{3043}" + asm = RubyVM::InstructionSequence.compile(src).disasm + assert_equal(src.encoding, asm.encoding) + assert_predicate(asm, :valid_encoding?) src.encode!(Encoding::Shift_JIS) - assert_equal(true, RubyVM::InstructionSequence.compile(src).disasm.ascii_only?) - ensure - Encoding.default_internal = enc + asm = RubyVM::InstructionSequence.compile(src).disasm + assert_equal(src.encoding, asm.encoding) + assert_predicate(asm, :valid_encoding?) end LINE_BEFORE_METHOD = __LINE__