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

ruby-changes:35756

From: normal <ko1@a...>
Date: Wed, 8 Oct 2014 05:00:28 +0900 (JST)
Subject: [ruby-changes:35756] normal:r47838 (trunk): normalize reference to Timeout::Error

normal	2014-10-08 05:00:09 +0900 (Wed, 08 Oct 2014)

  New Revision: 47838

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

  Log:
    normalize reference to Timeout::Error
    
    From: John Bachir <j@j...>
    
    * bootstraptest/test_io.rb (assert_finish):
      normalize rescue for Timeout::Error
    * lib/net/ftp.rb (Net#read_timeout): ditto for doc
    * lib/resolv.rb (Resolv::ResolvTimeout): ditto for subclass
    * lib/webrick/httprequest.rb (_read_data): ditto for rescue
    * sample/timeout.rb (p timeout): ditto for call
    * test/drb/drbtest.rb (test_06_timeout): ditto
    * test/ruby/test_readpartial.rb (test_open_pipe): ditto
    * test/thread/test_queue.rb (test_queue_thread_raise): ditto
    * thread.c (rb_thread_s_handle_interrupt): ditto for doc
      [ruby-core:65481] [misc #10339]
    
    TimeoutError is a legacy constant, Timeout::Error is the canonical constant.
    This patch normalizes all code and comments to reference Timeout::Error.

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_io.rb
    trunk/lib/net/ftp.rb
    trunk/lib/resolv.rb
    trunk/lib/webrick/httprequest.rb
    trunk/sample/timeout.rb
    trunk/test/drb/drbtest.rb
    trunk/test/ruby/test_readpartial.rb
    trunk/test/thread/test_queue.rb
    trunk/thread.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47837)
+++ ChangeLog	(revision 47838)
@@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Oct  8 04:58:48 2014  John Bachir  <j@j...>
+
+	* bootstraptest/test_io.rb (assert_finish):
+	  normalize rescue for Timeout::Error
+	* lib/net/ftp.rb (Net#read_timeout): ditto for doc
+	* lib/resolv.rb (Resolv::ResolvTimeout): ditto for subclass
+	* lib/webrick/httprequest.rb (_read_data): ditto for rescue
+	* sample/timeout.rb (p timeout): ditto for call
+	* test/drb/drbtest.rb (test_06_timeout): ditto
+	* test/ruby/test_readpartial.rb (test_open_pipe): ditto
+	* test/thread/test_queue.rb (test_queue_thread_raise): ditto
+	* thread.c (rb_thread_s_handle_interrupt): ditto for doc
+	  [ruby-core:65481] [misc #10339]
+
 Wed Oct  8 04:38:29 2014  Rei Odaira  <Rei.Odaira@g...>
 
 	* test/ruby/test_process.rb (TestProcess#test_setsid): AIX
Index: bootstraptest/test_io.rb
===================================================================
--- bootstraptest/test_io.rb	(revision 47837)
+++ bootstraptest/test_io.rb	(revision 47838)
@@ -26,7 +26,7 @@ assert_finish 10, %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_io.rb#L26
       t1.join
       t2.join
     end
-  rescue LoadError, TimeoutError, NotImplementedError
+  rescue LoadError, Timeout::Error, NotImplementedError
   end
 }, '[ruby-dev:32566]'
 
Index: sample/timeout.rb
===================================================================
--- sample/timeout.rb	(revision 47837)
+++ sample/timeout.rb	(revision 47838)
@@ -8,7 +8,7 @@ end https://github.com/ruby/ruby/blob/trunk/sample/timeout.rb#L8
 p timeout(5) {
   45
 }
-p timeout(5, TimeoutError) {
+p timeout(5, Timeout::Error) {
   45
 }
 p timeout(nil) {
Index: lib/resolv.rb
===================================================================
--- lib/resolv.rb	(revision 47837)
+++ lib/resolv.rb	(revision 47838)
@@ -158,7 +158,7 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L158
   ##
   # Indicates a timeout resolving a name or address.
 
-  class ResolvTimeout < TimeoutError; end
+  class ResolvTimeout < Timeout::Error; end
 
   ##
   # Resolv::Hosts is a hostname resolver that uses the system hosts file.
Index: lib/webrick/httprequest.rb
===================================================================
--- lib/webrick/httprequest.rb	(revision 47837)
+++ lib/webrick/httprequest.rb	(revision 47838)
@@ -521,7 +521,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/httprequest.rb#L521
         }
       rescue Errno::ECONNRESET
         return nil
-      rescue TimeoutError
+      rescue Timeout::Error
         raise HTTPStatus::RequestTimeout
       end
     end
Index: lib/net/ftp.rb
===================================================================
--- lib/net/ftp.rb	(revision 47837)
+++ lib/net/ftp.rb	(revision 47838)
@@ -103,7 +103,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L103
     # Number of seconds to wait for one block to be read (via one read(2)
     # call). Any number may be used, including Floats for fractional
     # seconds. If the FTP object cannot read data in this many seconds,
-    # it raises a TimeoutError exception. The default value is 60 seconds.
+    # it raises a Timeout::Error exception. The default value is 60 seconds.
     attr_reader :read_timeout
 
     # Setter for the read_timeout attribute.
Index: thread.c
===================================================================
--- thread.c	(revision 47837)
+++ thread.c	(revision 47838)
@@ -1731,29 +1731,29 @@ handle_interrupt_arg_check_i(VALUE key, https://github.com/ruby/ruby/blob/trunk/thread.c#L1731
  * resource allocation code. Then, the ensure block is where we can safely
  * deallocate your resources.
  *
- * ==== Guarding from TimeoutError
+ * ==== Guarding from Timeout::Error
  *
- * In the next example, we will guard from the TimeoutError exception. This
- * will help prevent from leaking resources when TimeoutError exceptions occur
+ * In the next example, we will guard from the Timeout::Error exception. This
+ * will help prevent from leaking resources when Timeout::Error exceptions occur
  * during normal ensure clause. For this example we use the help of the
  * standard library Timeout, from lib/timeout.rb
  *
  *   require 'timeout'
- *   Thread.handle_interrupt(TimeoutError => :never) {
+ *   Thread.handle_interrupt(Timeout::Error => :never) {
  *     timeout(10){
- *       # TimeoutError doesn't occur here
- *       Thread.handle_interrupt(TimeoutError => :on_blocking) {
- *         # possible to be killed by TimeoutError
+ *       # Timeout::Error doesn't occur here
+ *       Thread.handle_interrupt(Timeout::Error => :on_blocking) {
+ *         # possible to be killed by Timeout::Error
  *         # while blocking operation
  *       }
- *       # TimeoutError doesn't occur here
+ *       # Timeout::Error doesn't occur here
  *     }
  *   }
  *
- * In the first part of the +timeout+ block, we can rely on TimeoutError being
- * ignored. Then in the <code>TimeoutError => :on_blocking</code> block, any
+ * In the first part of the +timeout+ block, we can rely on Timeout::Error being
+ * ignored. Then in the <code>Timeout::Error => :on_blocking</code> block, any
  * operation that will block the calling thread is susceptible to a
- * TimeoutError exception being raised.
+ * Timeout::Error exception being raised.
  *
  * ==== Stack control settings
  *
Index: test/ruby/test_readpartial.rb
===================================================================
--- test/ruby/test_readpartial.rb	(revision 47837)
+++ test/ruby/test_readpartial.rb	(revision 47838)
@@ -50,7 +50,7 @@ class TestReadPartial < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_readpartial.rb#L50
       w << 'abc'
       assert_equal('ab', r.readpartial(2))
       assert_equal('c', r.readpartial(2))
-      assert_raise(TimeoutError) {
+      assert_raise(Timeout::Error) {
         timeout(0.1) { r.readpartial(2) }
       }
     }
@@ -64,7 +64,7 @@ class TestReadPartial < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_readpartial.rb#L64
       assert_equal("de", r.readpartial(2))
       assert_equal("f\n", r.readpartial(4096))
       assert_equal("ghi\n", r.readpartial(4096))
-      assert_raise(TimeoutError) {
+      assert_raise(Timeout::Error) {
         timeout(0.1) { r.readpartial(2) }
       }
     }
Index: test/thread/test_queue.rb
===================================================================
--- test/thread/test_queue.rb	(revision 47837)
+++ test/thread/test_queue.rb	(revision 47838)
@@ -239,7 +239,7 @@ class TestQueue < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/thread/test_queue.rb#L239
     th1.raise
     sleep 0.1
     q << :s
-    assert_nothing_raised(TimeoutError) do
+    assert_nothing_raised(Timeout::Error) do
       timeout(1) { th2.join }
     end
   ensure
Index: test/drb/drbtest.rb
===================================================================
--- test/drb/drbtest.rb	(revision 47837)
+++ test/drb/drbtest.rb	(revision 47838)
@@ -190,10 +190,10 @@ module DRbCore https://github.com/ruby/ruby/blob/trunk/test/drb/drbtest.rb#L190
 
   def test_06_timeout
     ten = Onecky.new(10)
-    assert_raise(TimeoutError) do
+    assert_raise(Timeout::Error) do
       @there.do_timeout(ten)
     end
-    assert_raise(TimeoutError) do
+    assert_raise(Timeout::Error) do
       @there.do_timeout(ten)
     end
   end

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

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