Forum: Ruby-core [Backport 200 - Backport #7995][Open] RubyVM::InstructionSequence to_a not working for blocks

Posted by mmeltner (Michael Meltner) (Guest)
on 2013-03-01 17:46
(Received via mailing list)
Issue #7995 has been reported by mmeltner (Michael Meltner).

----------------------------------------
Backport #7995: RubyVM::InstructionSequence to_a not working for blocks
https://bugs.ruby-lang.org/issues/7995

Author: mmeltner (Michael Meltner)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Hello,

I try to convert this code into an array via 
RubyVM::InstructionSequence:
-----
def test
  yield
end
test do
  puts "hi there"
end
-----
then read it back via "iseq_s_load".

This causes an error that there is no block defined:
<compiled>:in `test': no block given (yield) (LocalJumpError)
        from <compiled>:in `<compiled>'

I assume there is a bug in iseq.c, line 1778:
rb_hash_aset(e, ID2SYM(rb_intern("blockptr")), ci->blockiseq ? 
seq_data_to_ary(ci->blockiseq) : Qnil);

as the corresponding line in compile.c is this:
VALUE vblock = rb_hash_aref(op, ID2SYM(rb_intern("block")));

so is the symbol name mixed up between "block" and "blockptr" ?

- Michael
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.