Bug #7995

RubyVM::InstructionSequence to_a not working for blocks

Added by Michael Meltner over 2 years ago. Updated 10 months ago.

Assignee:Koichi Sasada
ruby -v:- Backport:



I try to convert this code into an array via RubyVM::InstructionSequence:

def test
test do
puts "hi there"


then read it back via "iseq_s_load".

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:
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

Related issues

Duplicates Ruby trunk - Bug #9455: Blocks do not round-trip properly through ISeq dump/load Closed 01/27/2014


#1 Updated by Tomoyuki Chikanaga over 2 years ago

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

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

#2 Updated by Koichi Sasada about 2 years ago

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

#3 Updated by Hiroshi SHIBATA over 1 year ago

  • Target version changed from 2.1.0 to current: 2.2.0

#4 Updated by _ wanabe 10 months ago

  • Duplicates Bug #9455: Blocks do not round-trip properly through ISeq dump/load added

#5 Updated by _ wanabe 10 months ago

  • Status changed from Assigned to Closed

Fixed at r44720, #9455.

Also available in: Atom PDF