Bug #7995

RubyVM::InstructionSequence to_a not working for blocks

Added by Michael Meltner about 1 year ago. Updated 3 months ago.

[ruby-core:53077]
Status:Assigned
Priority:Normal
Assignee:Koichi Sasada
Category:YARV
Target version:current: 2.2.0
ruby -v:- Backport:

Description

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 "iseqsload".

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

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

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

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

  • Michael

History

#1 Updated by Tomoyuki Chikanaga about 1 year ago

  • Tracker changed from Backport to Bug
  • Project changed from Backport200 to ruby-trunk
  • Status changed from Open to Assigned
  • Assignee set to Koichi Sasada

Backport 200 is project for backport tickets. I'll move it to ruby-trunk.

#2 Updated by Koichi Sasada 7 months ago

  • Category set to YARV
  • Target version set to 2.1.0
  • ruby -v set to -

#3 Updated by Hiroshi SHIBATA 3 months ago

  • Target version changed from 2.1.0 to current: 2.2.0

Also available in: Atom PDF