summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-02 08:06:23 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-02 08:06:23 +0000
commit9b6125398f81ae359a67b00fcfab8cc08ebcbe8d (patch)
treec2ac057ba0601925b48b5c7a0bdbefec111a72c7
parent93d4433c14d87a32e5fec5fab678a6b1a94beaab (diff)
merges r29435 from trunk into ruby_1_9_2.
-- * io.c (rb_io_set_encoding): use rb_funcall2 when the io is not a T_FILE. [ruby-dev:42356] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--io.c7
-rw-r--r--version.h2
3 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a08289017c..acc292c73f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Oct 11 06:11:30 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
+ a T_FILE. [ruby-dev:42356]
+
Fri Oct 8 00:24:54 2010 James Edward Gray II <jeg2@ruby-lang.org>
* lib/csv.rb: Fixing documentation typos. [ruby-core:32712]
diff --git a/io.c b/io.c
index 6791edb217..9ed13a0296 100644
--- a/io.c
+++ b/io.c
@@ -137,7 +137,7 @@ VALUE rb_default_rs;
static VALUE argf;
-static ID id_write, id_read, id_getc, id_flush, id_readpartial;
+static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding;
static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
static VALUE sym_textmode, sym_binmode, sym_autoclose;
@@ -8661,6 +8661,10 @@ rb_io_set_encoding(int argc, VALUE *argv, VALUE io)
rb_io_t *fptr;
VALUE v1, v2, opt;
+ if (TYPE(io) != T_FILE) {
+ return rb_funcall2(io, id_set_encoding, argc, argv);
+ }
+
opt = pop_last_hash(&argc, argv);
rb_scan_args(argc, argv, "11", &v1, &v2);
GetOpenFile(io, fptr);
@@ -9838,6 +9842,7 @@ Init_IO(void)
id_getc = rb_intern("getc");
id_flush = rb_intern("flush");
id_readpartial = rb_intern("readpartial");
+ id_set_encoding = rb_intern("set_encoding");
rb_define_global_function("syscall", rb_f_syscall, -1);
diff --git a/version.h b/version.h
index 673f95a519..70cbba1563 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 64
+#define RUBY_PATCHLEVEL 65
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1