Forum: Ruby-dev RubyVM::InstructionSequence to accept IOs

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
shyouhei (Shyouhei Urabe) (Guest)
on 2012-10-27 01:30
(Received via mailing list)
Issue #2674 has been updated by shyouhei (Shyouhei Urabe).

ko1 (Koichi Sasada) wrote:
> これ,どうでしょう.
> 卜部君にお願いすればいいでしょうか.


Feature #2674: RubyVM::InstructionSequence to accept IOs

Author: shyouhei (Shyouhei Urabe)
Status: Assigned
Priority: Normal
Assignee: shyouhei (Shyouhei Urabe)
Category: YARV
Target version: 2.0.0


 Signed-off-by: Urabe, Shyuohei <>
  iseq.c |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)

 diff --git a/iseq.c b/iseq.c
 index 3c957c7..2d86f5d 100644
 --- a/iseq.c
 +++ b/iseq.c
 @@ -538,10 +538,14 @@ rb_iseq_compile_with_option(VALUE src, VALUE
file, VALUE line, VALUE opt)
      rb_compile_option_t option;
      const char *fn = StringValueCStr(file);
      int ln = NUM2INT(line);
 -    NODE *node = parse_string(StringValue(src), fn, ln);
 +    NODE *node;
      rb_thread_t *th = GET_THREAD();
      make_compile_option(&option, opt);

 +    if (rb_obj_respond_to(src, rb_intern("gets"), 0))
 +        node = rb_compile_file(fn, src, ln);
 +    else
 +        node = rb_compile_string(fn, StringValue(src), ln);
      if (th->base_block && th->base_block->iseq) {
    return rb_iseq_new_with_opt(node, th->base_block->iseq->name,
              file, line, th->base_block->iseq->self,
This topic is locked and can not be replied to.