Skip to content

Commit

Permalink
IO.new: don't raise a warning in case a block is passed
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@5007 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed Dec 9, 2010
1 parent 7b13453 commit ada7290
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions io.c
Expand Up @@ -2399,12 +2399,12 @@ rb_io_s_popen(VALUE klass, SEL sel, int argc, VALUE *argv)
*
*/

static VALUE rb_io_s_new(VALUE klass, SEL sel, int argc, VALUE *argv);
static VALUE rb_io_s_new0(VALUE klass, int argc, VALUE *argv);

static VALUE
rb_io_s_open(VALUE klass, SEL sel, int argc, VALUE *argv)
{
VALUE io = rb_io_s_new(klass, sel, argc, argv);
VALUE io = rb_io_s_new0(klass, argc, argv);
if (rb_block_given_p()) {
VALUE ret = rb_vm_yield(1, &io);
rb_io_close(io);
Expand Down Expand Up @@ -3200,6 +3200,12 @@ rb_file_initialize(VALUE io, SEL sel, int argc, VALUE *argv)
* World
*/

static VALUE
rb_io_s_new0(VALUE klass, int argc, VALUE *argv)
{
return rb_class_new_instance(argc, argv, klass);
}

static VALUE
rb_io_s_new(VALUE klass, SEL sel, int argc, VALUE *argv)
{
Expand All @@ -3220,7 +3226,7 @@ rb_io_s_new(VALUE klass, SEL sel, int argc, VALUE *argv)
cname, cname);
}
}
return rb_class_new_instance(argc, argv, klass);
return rb_io_s_new0(klass, argc, argv);
}

static inline void
Expand Down

0 comments on commit ada7290

Please sign in to comment.