From d7ae6db23f1a2763e426bd01a2e109c2f10c798e Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 19 Mar 2008 14:52:43 +0000 Subject: * io.c (rb_io_putc, rb_io_puts): ouput directly if the reciever is rb_stdout to get rid of infinite recursion. [ruby-dev:34059] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index 1f2af9fb2..cd1c590c4 100644 --- a/io.c +++ b/io.c @@ -4485,6 +4485,9 @@ rb_io_putc(VALUE io, VALUE ch) static VALUE rb_f_putc(VALUE recv, VALUE ch) { + if (recv == rb_stdout) { + return rb_io_putc(recv, ch); + } return rb_funcall2(rb_stdout, rb_intern("putc"), 1, &ch); } @@ -4562,8 +4565,11 @@ rb_io_puts(int argc, VALUE *argv, VALUE out) */ static VALUE -rb_f_puts(int argc, VALUE *argv) +rb_f_puts(int argc, VALUE *argv, VALUE recv) { + if (recv == rb_stdout) { + return rb_io_puts(argc, argv, recv); + } return rb_funcall2(rb_stdout, rb_intern("puts"), argc, argv); } -- cgit