[前][次][番号順一覧][スレッド一覧]

ruby-changes:35058

From: nagachika <ko1@a...>
Date: Mon, 11 Aug 2014 23:53:08 +0900 (JST)
Subject: [ruby-changes:35058] nagachika:r47140 (ruby_2_1): merge revision(s) r46151, r46165: [Backport #9865]

nagachika	2014-08-11 23:53:01 +0900 (Mon, 11 Aug 2014)

  New Revision: 47140

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47140

  Log:
    merge revision(s) r46151,r46165: [Backport #9865]
    
    * io.c (rb_io_fileno, rb_io_inspect): non-modification does not
      error on frozen IO.  [ruby-dev:48241] [Bug #9865]
    
    * io.c (rb_io_autoclose_p): Don't raise on frozen IO.
    
    * test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/io.c
    branches/ruby_2_1/test/ruby/test_io.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 47139)
+++ ruby_2_1/ChangeLog	(revision 47140)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Aug 11 23:38:20 2014  Tanaka Akira  <akr@f...>
+
+	* io.c (rb_io_autoclose_p): Don't raise on frozen IO.
+
+Mon Aug 11 23:38:20 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (rb_io_fileno, rb_io_inspect): non-modification does not
+	  error on frozen IO.  [ruby-dev:48241] [Bug #9865]
+
 Mon Aug 11 22:34:47 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (posix_fadvise): disable use of posix_fadvise
Index: ruby_2_1/io.c
===================================================================
--- ruby_2_1/io.c	(revision 47139)
+++ ruby_2_1/io.c	(revision 47140)
@@ -1914,10 +1914,10 @@ rb_io_fdatasync(VALUE io) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/io.c#L1914
 static VALUE
 rb_io_fileno(VALUE io)
 {
-    rb_io_t *fptr;
+    rb_io_t *fptr = RFILE(io)->fptr;
     int fd;
 
-    GetOpenFile(io, fptr);
+    rb_io_check_closed(fptr);
     fd = fptr->fd;
     return INT2FIX(fd);
 }
@@ -1969,7 +1969,7 @@ rb_io_inspect(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/io.c#L1969
     VALUE result;
     static const char closed[] = " (closed)";
 
-    fptr = RFILE(rb_io_taint_check(obj))->fptr;
+    fptr = RFILE(obj)->fptr;
     if (!fptr) return rb_any_to_s(obj);
     result = rb_str_new_cstr("#<");
     rb_str_append(result, rb_class_name(CLASS_OF(obj)));
@@ -7519,8 +7519,8 @@ rb_io_s_for_fd(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_1/io.c#L7519
 static VALUE
 rb_io_autoclose_p(VALUE io)
 {
-    rb_io_t *fptr;
-    GetOpenFile(io, fptr);
+    rb_io_t *fptr = RFILE(io)->fptr;
+    rb_io_check_closed(fptr);
     return (fptr->mode & FMODE_PREP) ? Qfalse : Qtrue;
 }
 
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 47139)
+++ ruby_2_1/version.h	(revision 47140)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.2"
 #define RUBY_RELEASE_DATE "2014-08-11"
-#define RUBY_PATCHLEVEL 198
+#define RUBY_PATCHLEVEL 199
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_1/test/ruby/test_io.rb
===================================================================
--- ruby_2_1/test/ruby/test_io.rb	(revision 47139)
+++ ruby_2_1/test/ruby/test_io.rb	(revision 47140)
@@ -1122,6 +1122,8 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_io.rb#L1122
   def test_inspect
     with_pipe do |r, w|
       assert_match(/^#<IO:fd \d+>$/, r.inspect)
+      r.freeze
+      assert_match(/^#<IO:fd \d+>$/, r.inspect)
     end
   end
 
@@ -2751,6 +2753,21 @@ End https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_io.rb#L2753
     assert_equal(2, $stderr.fileno)
   end
 
+  def test_frozen_fileno
+    bug9865 = '[ruby-dev:48241] [Bug #9865]'
+    with_pipe do |r,w|
+      fd = r.fileno
+      assert_equal(fd, r.freeze.fileno, bug9865)
+    end
+  end
+
+  def test_frozen_autoclose
+    with_pipe do |r,w|
+      fd = r.fileno
+      assert_equal(true, r.freeze.autoclose?)
+    end
+  end
+
   def test_sysread_locktmp
     bug6099 = '[ruby-dev:45297]'
     buf = " " * 100

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r46151,46165


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]